Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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