go-socket.io icon indicating copy to clipboard operation
go-socket.io copied to clipboard

server how to close socket.io connection?

Open plum330 opened this issue 4 years ago • 3 comments

directly call Close()? When I directly call Close(), client will retry again. If I want to set code when server close socket.io connection, what should I do? THX!

plum330 avatar Nov 11 '21 10:11 plum330

Socket.io connection have method Close() for your case. Connection's instance available into handler method

client will retry again.

I am not sure for this behaviour.

what should I do?

Hm.... Good question. I don't know. We nedd some experiments with it case

sshaplygin avatar Nov 11 '21 14:11 sshaplygin

Close() only stop accepting new connections, is there a way to close active connections ? My program is stuck in graceful http shutdown, waiting srv.closeIdleConns() https://pkg.go.dev/net/[email protected]#Server.Shutdown

zhuzhengyang avatar Nov 15 '21 09:11 zhuzhengyang

How is it going now? I have the similar issue for authentication, when I directly call Close() if authentication failed, the client will handle disconnect signal, so it will reconnect. Or, is there any way to use middleware just like the javascript library.

image

Best Regards

poplark avatar May 09 '23 02:05 poplark