HTML and CSS Reference
In addition, once the connection is established, the client can send messages to the server
connection.send('this is a message');
Another major benefit of Web Sockets is that they can be used to perform cross-origin calls.
As we have seen above, AJAX calls are limited by the same-origin policy: Web Sockets
have no such restrictions. It is up to the server to determine if it will accept requests from
all origins, or restrict requests to specific origins.
Web sockets are a young technology, and currently lack support in most web servers. In
addition, despite the efforts made with the protocol, it may not work with proxy servers
or firewalls. Node.js does however provide support for Web Sockets via various libraries.
There are also servers available using Python, Ruby, PHP and Java.
It is likely to be a number of years before Web Sockets see widespread use, but it is a tech-
nology to watch. Once the implementation hurdles have been addressed, and common web
servers begin to provide support, they are likely to see significant use.