Created
July 22, 2020 04:24
-
-
Save domino14/ef57e613ceeff2fcd5a9d9a1e11814dd to your computer and use it in GitHub Desktop.
Websocket hub for liwords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Realm string | |
type Hub struct { | |
// Registered clients. | |
clients map[*Client]Realm | |
clientsByUserID map[string]map[*Client]bool | |
register chan *Client | |
unregister chan *Client | |
pubsub *PubSub | |
realmMutex sync.Mutex | |
// Each realm has a list of clients in it. | |
realms map[Realm]map[*Client]bool | |
broadcastRealm chan RealmMessage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment