coder / coder/websocket

[chat example] How to simulate slow connection?

Open
#542 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5.5k
Forks
372
PR merge metrics
No merged PRs in 30d

Description

I want to observe in what scenario `closeSlow` is called, How to simulate slow connection mentioned in [websocket/internal/examples/chat/chat.go](https://github.com/coder/websocket/blob/v1.8.14/internal/examples/chat/chat.go#L120-L127)?:
```
s := &subscriber{
msgs: make(chan []byte, cs.subscriberMessageBuffer),
closeSlow: func() {
mu.Lock()
defer mu.Unlock()
closed = true
if c != nil {
c.Close(websocket.StatusPolicyViolation, "connection too slow to keep up with messages")
}
},
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.