{"id":20845528,"url":"https://github.com/dzintars/wss","last_synced_at":"2026-05-15T18:34:41.961Z","repository":{"id":111605429,"uuid":"259906591","full_name":"dzintars/wss","owner":"dzintars","description":"Test setup (Don't use!) Redux -\u003e WSS -\u003e RPC","archived":false,"fork":false,"pushed_at":"2021-09-27T18:28:22.000Z","size":51,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-19T04:46:53.317Z","etag":null,"topics":["go","redux","rpc","websockets"],"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/dzintars.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":"2020-04-29T11:28:01.000Z","updated_at":"2021-09-27T18:28:25.000Z","dependencies_parsed_at":"2023-03-07T15:00:46.716Z","dependency_job_id":null,"html_url":"https://github.com/dzintars/wss","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzintars%2Fwss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzintars%2Fwss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzintars%2Fwss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzintars%2Fwss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dzintars","download_url":"https://codeload.github.com/dzintars/wss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243206346,"owners_count":20253645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["go","redux","rpc","websockets"],"created_at":"2024-11-18T02:13:12.964Z","updated_at":"2025-10-08T13:02:25.648Z","avatar_url":"https://github.com/dzintars.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebSockets\n\nMy attempt to create Slack like Teams/Channels architecture.\n\nhttps://github.com/dzintars/srp/blob/76194cf379eafa3822ba88e3155fde55a6be8c66/clients/router/static/src/js/redux/actions/messages.js\n\nhttps://www.youtube.com/watch?v=norUcMSJRtQ\n\nhttps://exec64.co.uk/blog/websockets_with_redux/ (saved in Library)\n\nImportant article for dynamic json unmarshalling\nhttps://eagain.net/articles/go-json-kind/ (saved in Library)\nStill need to implement Methods instead of type switches.\n\n## Todo\n\n- Rate limiting for messages, nickname changes, etc\n- Organization (chatrooms)\n- Teams in organizations\n- Methods instead of type switches\n\nIf there is no session cookie, then we need to force user to sign in\n\nIf there is an session cookie, then we just open an connection. Probably we need to track all user sessions because he could use multiple browser tabs or clients.\n\nWe should use gorilla secure cookie, because we can easy share encryption key across servers.\n\nWe exchange pure actions over wss.\n\nIf user are in Order view and there are no other users online in the same order view, then e don't need to create a \"chat room\" for that order. But as soon as\nsecond user enters the same view, we move booth users in the same connection group???\n\nUser roles?\n\nThe Hub. What is the Hub? Do i really create a Hub for every single user?\n\n[GitHub Example WSS]()https://github.com/gorilla/websocket/tree/master/examples/chat)\n\nPool is an object holding all active Hubs.\nEvery organization with at least one user online have it's own dedicated Hub in that Pool.\nOrganization Hub is organized in Channels.\nEvery Channel is a application level View at which every Organization user currently are in.\nWhen last user leaves the current View, that Channel is removed from Hub to clean up the memory and new Channel is created according to the View user navigated to.\nIf new user joins the View where other user is already on, then new user gets joined to existing Channel and further actions/messages are synced between booth users.\nEvery user can be part of multiple Organization Channels. For example, he can receive Organization wide events while working in Customer or Order level view/Channel.\nEvery user can be part of multiple Hubs. For example he can receive System wide events (System itself is an Organization) and Organization wide events.\n\nMain target of this organization is to reduce network traffic and broadcast/receive only what is really required for communications. There is no need to broadcast messages if there is no relative/authorized consumer.\n\n## Articles\n\nhttps://www.hascode.com/2016/10/writing-a-websocket-chat-in-go/comment-page-1/#comment-7064\n\n[Chat Rooms](https://github.com/gorilla/websocket/issues/46#issuecomment-227906715)\n\n[Go JSON unmarshaling based on an enumerated field value](https://eagain.net/articles/go-json-kind/)\n\n## GitHub\n\n## Use\n\n`go generate` to generate jsonenums\n\n`go run *.go -addr :9090` to run the server\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzintars%2Fwss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdzintars%2Fwss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzintars%2Fwss/lists"}