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

Detecting transport upgrades

Open neilpa opened this issue 4 years ago • 3 comments

Is there a way to detect when a connection upgrades it's transport from long polling to a websocket? In a JS you can hook the upgrade event on the connnection but I haven't found the equivalent for go (I did a little source code digging but didn't see anything obvious). I'm mostly interested for the purposes of logging the connection change.

neilpa avatar Feb 27 '20 21:02 neilpa

Didn't mean to submit this as a bug, but now I can't remove the label :/

neilpa avatar Feb 27 '20 21:02 neilpa

I could be wrong but as far as I know there is currently no way to do this. Should be pretty easy to add though.

Check out https://github.com/googollee/go-engine.io and feel free to contribute! :-)

Upgrade funcs: https://github.com/googollee/go-engine.io/blob/master/session.go#L199 https://github.com/googollee/go-engine.io/blob/master/session.go#L213

upgrade() gets called from here: https://github.com/googollee/go-engine.io/blob/master/server.go#L179

adrianmxb avatar Feb 27 '20 21:02 adrianmxb

@adrianmxb Does it actually?

sshaplygin avatar Apr 06 '20 01:04 sshaplygin