{"id":48037880,"url":"https://github.com/zients/unity-online-tic-tac-toe-client","last_synced_at":"2026-04-04T14:00:43.987Z","repository":{"id":104599059,"uuid":"225153696","full_name":"zients/unity-online-tic-tac-toe-client","owner":"zients","description":null,"archived":false,"fork":false,"pushed_at":"2020-08-24T17:51:40.000Z","size":22169,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-23T18:30:57.117Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zients.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-01T11:57:03.000Z","updated_at":"2023-06-12T04:35:50.000Z","dependencies_parsed_at":"2023-05-04T15:01:43.165Z","dependency_job_id":null,"html_url":"https://github.com/zients/unity-online-tic-tac-toe-client","commit_stats":null,"previous_names":["zients/unity-online-tic-tac-toe-client"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zients/unity-online-tic-tac-toe-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zients%2Funity-online-tic-tac-toe-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zients%2Funity-online-tic-tac-toe-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zients%2Funity-online-tic-tac-toe-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zients%2Funity-online-tic-tac-toe-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zients","download_url":"https://codeload.github.com/zients/unity-online-tic-tac-toe-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zients%2Funity-online-tic-tac-toe-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31402277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T14:00:29.518Z","updated_at":"2026-04-04T14:00:43.968Z","avatar_url":"https://github.com/zients.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Online TicTacToe Client\n\nThis is Online TicTacToe client made with Unity and Nakama-Unity-Client.\n\nTicTacToe Nakama Server : https://github.com/tsen1220/LuaOnlineTicTacToeServer\n\nWe need to import Nakama and LitJson to build this app.\n\nAnd we need to select 1024 x 768 (standalone).\n\n## Nakama Client Connect\n\nWe need to get session and client to let the websocket connected.\n\n```\n    ...\n    using Nakama;\n    ...\n    ...\n```\n\nFirst, we get the client information and create a new socket with client API : client.NewSocket().\n\nThen, try to get the session with deviceID and Nakama Client API : client.AuthenticateDeviceAsync(deviceID).\n\nAfter receiving the session, Take the session to build the socket with socket API : socket.ConnectAsync(session) .\n\n```\n\n    private readonly IClient client = new Client(\"defaultkey\");\n    public ISocket socket;\n    private ISession session;\n    \n    private async void Awake()\n        {\n            if (socket != null)\n            {\n            await socket.CloseAsync();\n            }\n\n            socket = client.NewSocket();\n            socket.Closed += () =\u003e Debug.Log(\"Socket closed.\");\n            socket.Connected += () =\u003e Debug.Log(\"Socket connected.\");\n            socket.ReceivedError += e =\u003e Debug.LogErrorFormat(\"Socket error: {0}\", e.Message);\n\n            var deviceId = SystemInfo.deviceUniqueIdentifier;\n            session = await client.AuthenticateDeviceAsync(deviceId);\n            await socket.ConnectAsync(session);\n\n        }\n\n```\n\n## Add And Remove Nakama Matchmaker Process\n\nWhen our socket has built, we can add to Nakama matchmaker pool and then get a matchmakerticket with socket API : \n\nsocket.AddMatchmakerAsync(query, minCount, maxCount, stringProperties, numericProperties) .\n\n```\n\nIMatchmakerTicket matchTicket= await socket.AddMatchmakerAsync(query, minCount, maxCount, stringProperties, numericProperties);\n\n\nquery: The match which you search contains requirements or rules. \"*\" means regardless of requirements.\n\nminCount: A match can start with minimum number of people.\n\nminCount: A match contains maximum number of people.\n\nstringProperties: Dictionary structure. The match extra information which value contains string.\n\nnumericProperties: Dictionary structure. The match extra information which value contains number.\n\n```\n\nIf we wish to leave the matchmaker, we can use socket API :  socket.RemoveMatchmakerAsync(matchTicket).\n\nThis action will remove your matchTicket and leave the matchmaker pool.\n\n```\n    {\n\n    await socket.RemoveMatchmakerAsync(matchTicket);\n\n    matchTicket: Get after adding to matchmaker pool.\n     \n    }\n```\n\n## Received Matchmaker Matched And Join Match\n\nClient has the event listener to handle the information When users in Nakama matchmaker pool are matched.\n\nThis part is associated with Nakama Server match_create with lua.\n\nWith socket API : socket.ReceivedMatchmakerMatched += matchedInformation =\u003e callback() .\n\n```\n\nsocket.ReceivedMatchmakerMatched += matched =\u003e\n        {\n           IMatchmakerMatched  MatchInfo = matched;\n        };\n\n        matched : Match information which contains MatchID.\n\n```\n\nAnd players can join the match after receiving the match information from socket API : socket.ReceivedMatchmakerMatched.\n\nThis part is associated with Nakama Server match_join_attempt and match_join with lua.\n\n```\n     await socket.JoinMatchAsync(matchInfo.MatchId);\n```\n\n## Match Running\n\nThis part is associated with Nakama Server match_loop with lua.\n\nWe can send json_encode_data about match to Nakama Server with socket API : socket.SendMatchStateAsync( MatchId, opCode, json_encode_data );\n\n```\n       await socket.SendMatchStateAsync(matchInfo.MatchId, 1, drawPostion.ToJson());\n```\n\nAnd Receive the Nakama server data with socket API : socket.ReceivedMatchState += data =\u003e callback().\n\n\n```\n        socket.ReceivedMatchState += data =\u003e\n        {\n            if(data.OpCode == 3)\n            {\n              ...\n              ...\n              ...\n              ...\n              ...\n            }\n\n            if (data.OpCode == 5)\n            {\n               ...\n               ...\n               ...\n               ...\n               ...\n            }\n\n        };\n\n        data : data from Nakama Server.\n```\n\n## Match Leave\n\nWhen game is over, player can click leave button to leave the match.\n\nUse socket API : socket.LeaveMatchAsync(MatchId);\n\n```\n\nawait socket.LeaveMatchAsync(matchInfo.MatchId);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzients%2Funity-online-tic-tac-toe-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzients%2Funity-online-tic-tac-toe-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzients%2Funity-online-tic-tac-toe-client/lists"}