2

So, I'm debugging a web app that uses socket.io on an iPad tablet.

Connected to the Internet through the same router as my deskop computer, I noticed packets take much longer (up to 3 seconds longer) to arrive to the iPad browser (both Chrome 56 and Safari 10) compared to how fast they arrive to my desktop browser (Chromium 56).

So I figured, maybe socket.io is using long-polling for some reason on the iPad, and WebSockets on my desktop computer.

Safari and Chrome for iOS obviously support WebSockets, so I want to first confirm this theory and then find a way to stop long-polling and use WebSockets.

In order to test this theory, I need a way to find out whether the app is using long-polling or WebSockets, but I don't have access to remote debugging tools for iOS (i.e. a Mac or Windows computer).

Does socket.io provide an interface I can use to probe what connection mode it's currently using?

Gui Prá
  • 5,559
  • 4
  • 34
  • 59
  • 1
    You can "temporarily" change your code to force webSocket only (no polling) as described here: [Socket.io 1.x: use WebSockets only?](http://stackoverflow.com/questions/28238628/socket-io-1-x-use-websockets-only/28240802#28240802). If your code is suddenly faster on the iPad, then you can conclude it must have not been using webSocket. Probably, you can reach into the adapter to find out if it's polling, but that does not appear to be documented so you'd have to be able to sleuth around in a debugger while it was polling to find that info. – jfriend00 Feb 21 '17 at 18:05
  • Possible duplicate of [Socket IO | How to get the client transport type on the serverside?](http://stackoverflow.com/questions/6280818/socket-io-how-to-get-the-client-transport-type-on-the-serverside) – Dmitry Gusarov May 06 '17 at 18:51
  • I think this is the answer: http://stackoverflow.com/questions/6280818/socket-io-how-to-get-the-client-transport-type-on-the-serverside – Dmitry Gusarov May 06 '17 at 18:52

0 Answers0