How lightweight is Socket.io? Would I be able to emit a message from my client to my server every second without problems?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.