{"id":20956769,"url":"https://github.com/markbrown4/websocket-demo","last_synced_at":"2025-07-24T22:09:17.630Z","repository":{"id":147916838,"uuid":"56421643","full_name":"markbrown4/websocket-demo","owner":"markbrown4","description":"Super simple WebSocket demo","archived":false,"fork":false,"pushed_at":"2016-04-29T20:49:38.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-14T05:34:43.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/markbrown4.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}},"created_at":"2016-04-17T06:04:37.000Z","updated_at":"2021-02-12T05:08:23.000Z","dependencies_parsed_at":"2023-03-27T16:33:47.421Z","dependency_job_id":null,"html_url":"https://github.com/markbrown4/websocket-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/markbrown4/websocket-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbrown4%2Fwebsocket-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbrown4%2Fwebsocket-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbrown4%2Fwebsocket-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbrown4%2Fwebsocket-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markbrown4","download_url":"https://codeload.github.com/markbrown4/websocket-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markbrown4%2Fwebsocket-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502180,"owners_count":23618558,"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":[],"created_at":"2024-11-19T01:27:50.625Z","updated_at":"2025-07-09T17:09:37.727Z","avatar_url":"https://github.com/markbrown4.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# WebSocket demo\n\nThe WebSocket API allows you to to maintain a continuous two-way connection between client and server.\nMessages can be sent and received on both ends.\n\n```bash\nnpm install\nnpm start\nopen http://localhost:8080/\n```\n\nTry opening multiple browsers and looking at the logs on client and server.\nHere's what's happening:\n\n- The client connects to `ws://localhost:8081/` via a `WebSocket`\n- The client sends `{ message: 'Hello' }` to the server\n- The server sends `{ message: 'Gotcha '}` when a connection is established.\n- The server keeps track of all connections in `wss.clients`\n- Every three seconds the server broadcasts `{ message: 'Hello hello!' }` to all connections.\n- Connections can be closed by hitting the `Close` button or closing the window.\n- You can send `{ message: 'Hey' }` to the server by hitting `Send Message`.\n- The server sends `{ message: 'Something changed' }` to all connections when a message is received.\n\n## Links\n\n- [React to data changes](http://rauchg.com/2014/7-principles-of-rich-web-applications/#react-to-data-changes)\n- [Writing WebSocket client applications](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications)\n- [Writing WebSocket servers](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers)\n- [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbrown4%2Fwebsocket-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkbrown4%2Fwebsocket-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkbrown4%2Fwebsocket-demo/lists"}