File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
# Chat Example
2
2
3
- This directory contains a full stack example
4
- of a simple chat webapp using nhooyr.io/websocket.
3
+ This directory contains a full stack example of a simple chat webapp using nhooyr.io/websocket.
5
4
6
5
``` bash
7
6
$ cd example
@@ -15,11 +14,11 @@ Visit the printed URL to submit and view broadcasted messages in a browser.
15
14
16
15
## Structure
17
16
18
- The frontend is contained in ` index.html ` , ` index.js ` and ` index.css ` . It setups the
19
- DOM with a form at the buttom to submit messages and at the top is a scrollable div
20
- that is populated with new messages as they are broadcast. The messages are received
21
- via a WebSocket and messages are published via a POST HTTP endpoint.
17
+ The frontend is contained in ` index.html ` , ` index.js ` and ` index.css ` . It sets up the
18
+ DOM with a scrollable div at the top that is populated with new messages as they are broadcast.
19
+ At the bottom it adds a form to submit messages.
20
+ The messages are received via the WebSocket ` /subscribe ` endpoint and published via
21
+ the HTTP POST ` /publish ` endpoint.
22
22
23
23
The server portion is ` main.go ` and ` chat.go ` and implements serving the static frontend
24
- assets as well as the ` /subscribe ` WebSocket endpoint for subscribing to
25
- broadcast messages and ` /publish ` for publishing messages.
24
+ assets, the ` /subscribe ` WebSocket endpoint and the HTTP POST ` /publish ` endpoint.
You can’t perform that action at this time.
0 commit comments