googollee / go-socket.io

socket.io library for golang, a realtime application framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-socket.io server will automatic disconnect client

kevinkelin opened this issue · comments

Hi,
I try to use go-socket.io (v1.6.2) as socketio server, use python-socketIO(v5.2.1) as client

Here is my serever code

var socketconfig = &engineio.Options{
		PingTimeout:  5 * time.Second,
		PingInterval: 10 * time.Second,
		Transports: []transport.Transport{
			&polling.Transport{
				Client: &http.Client{
					Timeout: time.Minute,
				},
				CheckOrigin: func(r *http.Request) bool {
					return true
				},
			},
			&websocket.Transport{
				CheckOrigin: func(r *http.Request) bool {
					return true
				},
			},
		},
	}
	global.SocketIOServer = socketio.NewServer(socketconfig)

         global.SocketIOServer.OnDisconnect("/", func(c socketio.Conn, s string) {
		global.Logger.Info(fmt.Sprintf("%s connect disconnected", c.ID()))
	})

when client connect server, after 5 seconds, will automatic disconnect!

why 5 seconds?

I guess is the PingTimeout params take effect, I try to change the value, and after the value duration, the connection will disconnected!

I try to print the url that client viste, is /socket.io/?transport=websocket&EIO=4&t=1658570826.4926221

There is a param EIO, the value is 4, and is this mean Engine.IO protocol revision is 4?

Is this is the reason due to the client disconnection ? Compatibility issues?

I try to use python as the socket server, will not automatic disconnect.

which Engine version does this go-socket.io(v1.6.2) support?

The problem is solved, that is, the EIO version is wrong. I can downgrade python socketio to 4.6.1, and its EIO version is 3.

close it

Error:{error}
Handshake Details
Request URL: http://localhost:8000/socket.io/?EIO=4&transport=websocket
Request Method: GET
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: LWMNBSXFH7vhp0NmbE/s6w==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: localhost:8000