Skip to content

[chat example] How to simulate slow connection? #542

@mymirai-nikki

Description

@mymirai-nikki

I want to observe in what scenario closeSlow is called, How to simulate slow connection mentioned in websocket/internal/examples/chat/chat.go?:

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")
		}
	},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions