What Are WebSockets?
WebSockets are one of many new technologies coming to the web that should have people excited. WebSockets will allow real-time, two-way communication between the browser and the server. While this article won’t be getting into too much technical detail, if you are interested you can find more detailed information at the resources listed below.
A Brief Look Back
In the past a browser would make a request to a server and the server would respond with the content requested and that was all. The problem with this is that if something were to be updated on the server, the browser would not be made aware of it unless it made another request.
Where it Stands Today
The WebSocket API is available in all of the latest browsers including mobile. For the latest information on WebSocket availability you can check here. This is all great news from the browser side of things, but the server side gets a little bit more complicated.
There are a lot of server side libraries for a wide variety of languages to choose from. A good list can be found here. The only problem is that the technology is still very new and current hosting plans and web servers are not optimized to use WebSockets at this point.
As of today, using WebSockets is a viable option, but because of how new it is, the road may still be a little bumpy. As the use of the technology spreads it should become easier to implement, which will continue to increase its use.
Why We Are Excited
Here are just a few key benefits to WebSockets:
- Reduced network traffic. With WebSockets, there doesn’t need to be a full request/response for each new piece of information transferred.
- Near instantaneous communication. Real-time sales or pricing is a good example of something that requires as little delay as possible when sending and receiving information.
- Two-way communication. Being able to push from both the server and the browser can change the way websites are used.
The most exciting thing about WebSockets is all the new opportunities it will present. Like most new technologies the early applications of it will be rather obvious. Things like in-browser chatting, multiplayer gaming, real-time sales or pricing information, etc. are straight-forward applications of WebSockets.
Because of all these possibilities, it appears that WebSockets will be one of many new technologies coming out that will shape and define the future of the web.