Skip to content

Commit d44dcb9

Browse files
committed
chat-example: Add missing defer c.Close
1 parent ce5a002 commit d44dcb9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

chat-example/chat.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func (cs *chatServer) subscribeHandler(w http.ResponseWriter, r *http.Request) {
2727
log.Print(err)
2828
return
2929
}
30+
defer c.Close(websocket.StatusInternalError, "")
3031

3132
err = cs.subscribe(r.Context(), c)
3233
if errors.Is(err, context.Canceled) {

chat-example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div id="publish-form-container">
1717
<form id="publish-form">
1818
<input name="message" id="message-input" type="text" />
19-
<input value="Submit" type="submit"/>
19+
<input value="Submit" type="submit" />
2020
</form>
2121
</div>
2222
</div>

0 commit comments

Comments
 (0)