websocket 增加多分组 fork https://github.com/olahol/melody
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
724 B

10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
  1. package melody
  2. import "time"
  3. // Config melody configuration struct.
  4. type Config struct {
  5. WriteWait time.Duration // Milliseconds until write times out.
  6. PongWait time.Duration // Timeout for waiting on pong.
  7. PingPeriod time.Duration // Milliseconds between pings.
  8. MaxMessageSize int64 // Maximum size in bytes of a message.
  9. MessageBufferSize int // The max amount of messages that can be in a sessions buffer before it starts dropping them.
  10. }
  11. func newConfig() *Config {
  12. return &Config{
  13. WriteWait: 10 * time.Second,
  14. PongWait: 60 * time.Second,
  15. PingPeriod: (60 * time.Second * 9) / 10,
  16. MaxMessageSize: 512,
  17. MessageBufferSize: 256,
  18. }
  19. }