10000 Add chat example by nhooyr · Pull Request #190 · coder/websocket · GitHub
[go: up one dir, main page]

Skip to content

Add chat example #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename example directory to chat-example
  • Loading branch information
nhooyr committed Feb 17, 2020
commit ce5a002f0ff92d5dd70a8884d65f60831c94ce1b
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ go get nhooyr.io/websocket

For a production quality example that demonstrates the complete API, see the [echo example](https://godoc.org/nhooyr.io/websocket#example-package--Echo).

For a full stack example, see the [./example](./example) subdirectory which contains a chat example with a browser client.
For a full stack example, see [./chat-example](./chat-example).

### Server

Expand Down
2 changes: 1 addition & 1 deletion example/README.md → chat-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This directory contains a full stack example of a simple chat webapp using nhooyr.io/websocket.

```bash
$ cd example
$ cd chat-example
$ go run . localhost:0
listening on http://127.0.0.1:51055
```
Expand Down
2 changes: 1 addition & 1 deletion example/chat.go → chat-example/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (cs *chatServer) subscribeHandler(w http.ResponseWriter, r *http.Request) {
return
}
if websocket.CloseStatus(err) == websocket.StatusNormalClosure ||
websocket.CloseStatus(err) == websocket.StatusGoingAway {
websocket.CloseStatus(err) == websocket.StatusGoingAway {
return
}
if err != nil {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/index.html → chat-example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div id="publish-form-container">
<form id="publish-form">
<input name="message" id="message-input" type="text" />
<input type="submit" />
<input value="Submit" type="submit"/>
</form>
</div>
</div>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func newConnTest(t testing.TB, dialOpts *websocket.DialOptions, acceptOpts *webs
}
t.Helper()

ctx, cancel := context.WithTimeout(context.Background(), time.Second * 30)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
tt = &connTest{t: t, ctx: ctx}
tt.appendDone(cancel)

Expand Down
0