Reputation: 7266
Currently we have PHP Web Application which sends notification to the FrontEnd Client(running in the Browser) via Websockets. Now we are developing another client (Desktop application written in C / C++) which also needs to receive notifications from the Web Application. For this scenario(communication between Desktop Application and Web Server) which is better to use TCP Socket or WebSockets. What could be the Advantage of Web Sockets over TCP in terms of Firewall, Security, speed and resource conception.
If using TCP Socket is better then who should be binding and listening (HTTP Server or the Desktop Client)
I have referred the following questions before posting my question
Upvotes: 0
Views: 922
Reputation: 35963
The main difference is that browsers are websocket capable. It is a standard, so it has better interoperability. It has little overhead. Even if you roll your own TCP connection, you still need to frame the data, so you will end doing something similar. The websocket protocol is very simplistic.
A websocket connection starts as HTTP or HTTPS, so it is more likely it will go through firewalls. And proxy vendors will update their software to be websocket friendly, because it is a standard.
Upvotes: 2