File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 11# Chat Example
22
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.
54
65``` bash
76$ cd example
@@ -15,11 +14,11 @@ Visit the printed URL to submit and view broadcasted messages in a browser.
1514
1615## Structure
1716
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.
2222
2323The 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