Tuesday, March 1st 2016
WebSockets
So what are web sockets? WebSockets are a faster way to communicate smaller bits of information between the client and server. Generally, this results in faster performance for applications or browsers that require faster communication with smaller bits of information. What are WebSockets specifically? A WebSocket is an HTTP extension that when enabled will only require the initial 'handshake' between the server and the client to happen once, and from that point on the exchange of information, typically for the server, can happen continuously.
So where does the performance boost come from? The performance boost, despite some common misconceptions, does not come from the size of the information being sent, but rather the parsing of the logic contained with the message. This latency interferes with usability and performance. Websockets, however, have very low overhead (a header, mask and data) and are able to be parsed very quickly.
The takeaway is that one is not necessarily better than the other because they were both designed to serve different purposes. On the one hand, WebSockets were designed for bi-directional communication between a client and server whereas HTTP was designed for a wide range of different uses, requiring a more structured and compartmentalized req/res system.
References:
http://stackoverflow.com/questions/14703627/websockets-protocol-vs-http
http://blog.arungupta.me/rest-vs-websocket-comparison-benchmarks/
http://stackoverflow.com/questions/27376505/why-do-we-still-use-http-instead-of-websockets-for-building-web-applications?lq=1
No comments:
Post a Comment