mirror of https://github.com/gorilla/websocket.git
commit
a69d25be2f
|
@ -22,7 +22,7 @@ To use the chat example, open http://localhost:8080/ in your browser.
|
||||||
## Server
|
## Server
|
||||||
|
|
||||||
The server application defines two types, `Client` and `Hub`. The server
|
The server application defines two types, `Client` and `Hub`. The server
|
||||||
creates an instance of the `Client` type for each webscocket connection. A
|
creates an instance of the `Client` type for each websocket connection. A
|
||||||
`Client` acts as an intermediary between the websocket connection and a single
|
`Client` acts as an intermediary between the websocket connection and a single
|
||||||
instance of the `Hub` type. The `Hub` maintains a set of registered clients and
|
instance of the `Hub` type. The `Hub` maintains a set of registered clients and
|
||||||
broadcasts messages to the clients.
|
broadcasts messages to the clients.
|
||||||
|
@ -32,7 +32,7 @@ The application runs one goroutine for the `Hub` and two goroutines for each
|
||||||
has channels for registering clients, unregistering clients and broadcasting
|
has channels for registering clients, unregistering clients and broadcasting
|
||||||
messages. A `Client` has a buffered channel of outbound messages. One of the
|
messages. A `Client` has a buffered channel of outbound messages. One of the
|
||||||
client's goroutines reads messages from this channel and writes the messages to
|
client's goroutines reads messages from this channel and writes the messages to
|
||||||
the webscoket. The other client goroutine reads messages from the websocket and
|
the websocket. The other client goroutine reads messages from the websocket and
|
||||||
sends them to the hub.
|
sends them to the hub.
|
||||||
|
|
||||||
### Hub
|
### Hub
|
||||||
|
|
Loading…
Reference in New Issue