|
|
|
|
|
by lambda
5576 days ago
|
|
Because websockets, by definition, can only connect to the same domain as the page was served from (or another domain that opts in using CORS), websockets do not speak raw TCP but instead a special protocol that is designed to not allow them to trick browsers into accessing services that aren't expecting the browser to connect to them (such as using websockets to connect to SMTP servers and send spam, unbeknownst to the user), and because websockets can only be used for connecting from the browser to a server, not for listening for incoming connections. Don't be fooled by the name. Websockets are not a general socket interface in the web browser. It is simply an API and protocol for establishing a persistent, bidirectional communication channel between the browser and the server in order to better support applications like chat, notifications, live editing features, and the like, without having to resort to COMET techniques like polling, long-polling, and so on. |
|
And that API could be extended to support p2p design patterns if browsers decided to do so.