https://github.com/zianwar/go-websocket-broadcast
Broadcast server implementation using websockets in golang.
https://github.com/zianwar/go-websocket-broadcast
go go-broadcast go-websocket golang websocket
Last synced: 7 months ago
JSON representation
Broadcast server implementation using websockets in golang.
- Host: GitHub
- URL: https://github.com/zianwar/go-websocket-broadcast
- Owner: zianwar
- Created: 2019-06-10T20:32:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T23:51:36.000Z (over 3 years ago)
- Last Synced: 2024-06-21T17:52:29.109Z (about 2 years ago)
- Topics: go, go-broadcast, go-websocket, golang, websocket
- Language: Go
- Homepage:
- Size: 3.18 MB
- Stars: 18
- Watchers: 1
- Forks: 2
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## go-ws-broadcast
A simple implementation of a concurrent broadcast server that dispatches a message to the connected clients via the websocket protocol.

Components:
## [Broadcast Server](https://github.com/zianwar/go-ws-broadcast/tree/master/server)
consists of:
- A counter that gets incremented frequently and its value will be broadcasted to all clients.
- A hub component that registers and de-registers clients and broadcasts the counter value to the clients.
## [Web client](https://github.com/zianwar/go-ws-broadcast/tree/master/webclient)
This is a basic React app that acts as a client to the broadcast server, which:
- Establishes a websocket connection to the server and displays a green background upon a successfull connection.
- Starts reading the counter value and displaying it.
- Changes the background to red when the websocket connection closes or errors out.
## Demo
[](https://youtu.be/e7rBuhho3ks)