The HTML5 Web Messaging API can be used to communicate between independent pieces of code loaded into the browser (the specification calls them “viewing contexts”). For example, if your page contains an <iframe> and you want to reliably communicate between it and external code, you can use Web Messaging. Consider this explanation on the Opera dev portal:
Channel messaging is especially useful for multiple origins. Consider the following scenario. We have a document at http: //socialsite.example containing content from http: //games.example is embedded in one iframe, and content from http: //addressbook.example in another.
Now let's say that we want to send a message from our address book website to our gaming site. We could use a social site as a proxy. This, however, means the address book receives the same level of trust as the social site. Our social site either needs to be trusted each request, or filter them for us.
It is a messaging channel, however http: //addressbook.example and http: //games.example can be directly linked.
The web socket API can be used to communicate between the code loaded in the browser and the server. Thus, it serves a completely different purpose. Since you mention low latency and full duplex, I assume that you are talking about client-server communication, and therefore you are looking for web sockets.
source share