websocket: failed to WebSocket dial: unsupported permessage-deflate parameter: "server_max_window_bits=15"

I use this lib connect binance,2022.10.18 find this question。And then insert some code then can Bypass the problem。 dial.go ->verifyServerExtensions()

	for _, p := range ext.params {
		switch p {
		case "client_no_context_takeover":
			copts.clientNoContextTakeover = true
			continue
		case "server_no_context_takeover":
			copts.serverNoContextTakeover = true
			continue
		}
                //add code
		if strings.HasPrefix(p, "server_max_window_bits") {
			fmt.Println("server_max_window_bits:", p)
			continue
		}
		return nil, fmt.Errorf("unsupported permessage-deflate parameter: %q", p)
	}
    我在使用此包连接binance币安时,最近出现标题的错误,然后我尝试在websocket包的dial.go文件的verifyServerExtensions()函数中添加了兼容server_max_window_bits字段的代码,然后就能使用了。我看文档这字段功能好像是压缩之类的功能,不确定是否后续会出现新问题.
   抱歉,英文太菜了。

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@guotie Don’t expect maintainers to respond this fast lol they not paid

Just disable compression. Should work.

Going to just disable compression by default.

Disabling compression did it for me, thanks @nightwolfz!

I have had the issue on client side and had to set CompressionMode in the DailOptions:

conn, _, err := websocket.Dial(ctx, ADDR, &websocket.DialOptions{
	CompressionMode: websocket.CompressionDisabled,
})