Only reason I can think of is to traverse firewalls that block outbound sockets but don't block HTTP+WebSocket.
That aside, it seems a bit ridiculous, given that we already have sockets, to bolt on a protocol that exists almost solely to work around security issues involved in a browser opening a socket.
I think it's the same reason you would want to use good old HTTP over raw sockets for a request/response API, even though with a native client you could just invent your own protocol.
If you want bidirectional communication to your app, it's much easier to make a server that uses the WebSocket Protocol (tornado, etc.) instead of rolling your own server and protocol.
Comments
Is there any reason to use WebSockets on native apps other than if you want to share one server between native and web?
Only reason I can think of is to traverse firewalls that block outbound sockets but don't block HTTP+WebSocket.
That aside, it seems a bit ridiculous, given that we already have sockets, to bolt on a protocol that exists almost solely to work around security issues involved in a browser opening a socket.
I think it's the same reason you would want to use good old HTTP over raw sockets for a request/response API, even though with a native client you could just invent your own protocol.
If you want bidirectional communication to your app, it's much easier to make a server that uses the WebSocket Protocol (tornado, etc.) instead of rolling your own server and protocol.