node.js - Why is my socket.io using long polling instead of the websocket? -


so set socket.io nodejs + expressjs server , working well. problem realized emit() calls using fallback xhr method send event server rather websocket connection has open.

when view connection, see 2probe, 3probe, followed bunch of 2's , 3's being sent across websocket. connection appears open , working, why falling long polling xhr requests?

i not providing code right because not sure part relevant since functional aspect of code working great, want utilize websocket on xhr. let me know if there code see

update

so testing out sockets little more , added couple more emit() calls. appears first 1 or 2 emits use long polling , of sudden changes on using websocket. curious happening here.

since socket.io 1.x, fallback algorithm changed downgrade approach upgrade approach.

long polling pretty works everywhere, used @ first can "connection" right away. in background, attempt made upgrade long polling connection websocket connection. if upgrade successful, long polling stops , session switches websocket connection. if it's not successful, long polling "connection" stays open , continues used.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -