How lightweight is Socket.io? Would I be able to emit a message from my client to my server every second without problems?
Socket.io works using a stack of available IO mechanisms. First, it tries HTML5 web sockets. These essentially create a proper TCP socket, so there's very little overhead. As long as this is available, a mobile application should be fine.
However, the lower mechanisms on the stack involve Flash objects and polling with XmlHttpRequest
, the latter of which can be very wasteful when using a mobile application. I certainly wouldn't suggest using a 1 second polling rate on a phone.
My suggestion would be to detect when socket.io reverts to polling mode and alter the way your app works. Use a low-ish polling rate, but force update on demand when necessary.