node.js - When does socket.io use polling instead of websockets? -


i pretty new socket.io , have written first app in node/express/socket.io. right works great on nginx server. want release app public, gripped fear won't work lot of people. have had few friends test app , went smoothly (it pretty simple app). here concern: right every connection seems using websockets, want. app downgrade "polling" due weird on clients' end? if so, how socket.io decide when use polling , when use websocket (is based on browser/version or connection or what)? pretty sure uses websocket when possible, there list somewhere of conditions knock down "polling"? also, there way can test application using "polling" see if works?

i can post code, think general question on how socket.io works.

the time client downgrade ajax polling (assuming server support does) when browser client doesn't support websockets (e.g. old client) or perhaps if proxy in client path doesn't support websockets.

websockets supported in ie10+ , recent releases of other browsers.

so, practically speaking, it's ie8 or ie9 or badly behaved proxy might not see client websocket support.

there no other conditions (other lack of support) "knock" connection down polling.


you can temporarily test application polling passing in xhr-polling transport option when connecting client tell client that transport option allowed.


keep in mind websocket connections start http request "upgraded" websocket protocol if both sides agree if you're looking @ network trace browser, should see each websocket connection start http request - normal. and, in latest version of socket.io, may exchange few data packets polling transport before tries , switches actual websocket.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -