lxzan / gws

simple, fast, reliable websocket server & client, supports running over tcp/kcp/unix domain socket. keywords: ws, proxy, chat, go, golang...
https://pkg.go.dev/github.com/lxzan/gws
Apache License 2.0
1.34k stars 84 forks source link

ClientOption.TlsConfig.ServerName should not contain port number #78

Closed Andrey36652 closed 6 months ago

Andrey36652 commented 7 months ago

I'm trying to connect to wss://ws.okx.com:8443/ws/v5/public as a client and get error remote error: tls: handshake failure. Reason is this line https://github.com/lxzan/gws/blob/5c407ad8e047c7618f321de9b5180caf66002132/client.go#L59 should be

option.TlsConfig.ServerName = URL.Hostname()

because URL.Host includes port number, while URL.Hostname() does not

lxzan commented 7 months ago

Let's manually assign a value to the serverName first, we'll fix that later.

lxzan commented 7 months ago

Or use this commit hash for now

go get -u -v github.com/lxzan/gws@340485a22b22164fcea48ab8cc4e680a6f396100
nightwolfz commented 6 months ago

Thanks for the fix, I was also having problems with okx

lxzan commented 6 months ago

small problem