strings95
strings95

Reputation: 681

Websocket's overhead on non-browser devices

I'm currently working on an android project. We have a real-time application which should work on smartphones (Generally android and iOS) and browsers. To achieve this goal we use socket.io's websocket transport.

The question is what are the differences and overheads between opening a websocket and raw TCP connection in non-browser applications. And does it worth to have multiple APIs (websocket and raw TCP) on one project for different clients?

Upvotes: 0

Views: 196

Answers (1)

M3-n50
M3-n50

Reputation: 873

I've almost asked the same question yesterday. The answer provided there should kinda cover your first question.

Since websockets is built on top of TCP I don't think it's worth it to have both websockets and raw TCP simultaneously. If you're making a new application and the code hasn't been written yet, I'd suggest using websockets. It'd take much longer to make up your own efficient and working protocol. Also if I understood it well, websockets can operate on the same port as a HTTP server, so it will have less chance to be blocked by a firewall. The link I gave you also states some other advantages or reasons to use websockets over TCP.

Upvotes: 2

Related Questions