So I set up socket.io with a NodeJS + ExpressJS server and everything is working well. The only problem is I just realized that my emit()
calls are using the fallback XHR method to send the event to my server rather than the websocket connection it has open.
When I view the connection, all I see are some 2probe
, 3probe
, followed by a bunch of 2's and 3's being sent across the websocket. This connection appears to be open and working, so why is it falling back to long polling with XHR requests?
I am not providing any code right now because I am not sure what part would be relevant since the functional aspect of the code is working great, I just want to utilize the websocket over XHR. Let me know if there is any code you would like to see
UPDATE
So I was testing out the sockets a little more and I added a couple more emit()
calls. It appears like the very first 1 or 2 emits use the long polling and then all of a sudden it changes over to using the websocket. Just curious what is happening here.