{"id":25267462,"url":"https://github.com/banyango/socker","last_synced_at":"2026-04-27T22:31:26.801Z","repository":{"id":146524691,"uuid":"186060766","full_name":"Banyango/socker","owner":"Banyango","description":"Cleanly handle state of the client/server connection when using binary websocket messaging.","archived":false,"fork":false,"pushed_at":"2019-06-21T17:40:39.000Z","size":36,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-24T03:03:54.107Z","etag":null,"topics":["connection","golang","state-machine","webrtc","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","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/Banyango.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}},"created_at":"2019-05-10T22:13:39.000Z","updated_at":"2024-06-19T07:39:35.807Z","dependencies_parsed_at":"2023-04-22T11:02:49.086Z","dependency_job_id":null,"html_url":"https://github.com/Banyango/socker","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/Banyango/socker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyango%2Fsocker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyango%2Fsocker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyango%2Fsocker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyango%2Fsocker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Banyango","download_url":"https://codeload.github.com/Banyango/socker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyango%2Fsocker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32358509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["connection","golang","state-machine","webrtc","websocket"],"created_at":"2025-02-12T09:37:57.072Z","updated_at":"2026-04-27T22:31:26.786Z","avatar_url":"https://github.com/Banyango.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](./site/logo.png)\n# Socker\n\nA lib for doing client/server state logic using websockets.\n\nMy game server is using WebRTC DataChannels for handling the data sent from the clients to the servers. This is a twist on WebRTC where a client opens a connection with the server and each sets up a single data channel peer connection through a websocket. This gets us a reliable UDP connection to the browser, which is great because websockets run over TCP and if we use them for game data we'd potentially run into issues. However WebRTC with a websocket setup requires a few back and forth steps based on the state of each side.\n\n`Socker helps facilitate moving a server/client state forwards based on handlers.`\n\n\n_Anyways this project is probably pretty specific to my needs but I thought I'd throw it up on github because why not._   \n\n#### My Example \n___\n\n|Server|Client|\n|------|------|\n|Setup websocket| |\n| | Client connects to websocket\n|Server sends list of buffered scene creation data| |\n| |Client creates scene and data from server|\n| | Client sends handshake to notify that it's ready to receive webrtc connection info.\n|Server gets handshake and sends webrtc data | |\n| | Client sets up webrtc connection and sends back webrtc info|\n| Server sets remoteDescription from the client| |\n| **Server listens for further websocket data** | **Client sends websocket data** |\n\n\n___\n\n#### Server.go\n\n``` \n// Client connects and sends a message \nconnection.Add(func(message []byte) bool {\n    // send all buffered data (other players, networked objects, state, etc)                 \n    return true\n})\n\n// Client sent the handshake for webrtc \nconnection.Add(func(message []byte) bool {\n    // Create the web rtc data channel\n    // Create Offer\n    // Send Offer to client.\n    return true\n})\n\n// Client sent the answer\nconnection.Add(func(message []byte) bool {\n    // Set RemoteDescription to answer.\n    // data channel is created.\n    return true\n})\n\nconnection.Add(func(message []byte) bool {\n    // Done setting up connection\n    // Can use this for any client data that needs to make sure it gets to server. (Disconnect, Some kind of state)\n    return false\n})\n\n\n ```\n ___\n \n#### Client.go\n\n``` \n// Server sends buffered data\nconnection.Add(func(message []byte) bool {\n    // Create all entities. \n    // Send webrtc connection request.                \n    return true\n})\n\n// Server sends offer \nconnection.Add(func(message []byte) bool {\n    // set remotedescription to offer.\n    // create answer.\n    // send answer.\n    return true\n})\n\nconnection.Add(func(message []byte) bool {\n    // handle server data messages that must reach client. (A player disconnects, joins, etc)\n    return false\n})\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanyango%2Fsocker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanyango%2Fsocker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanyango%2Fsocker/lists"}