Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use and purpose of websocket multiplexing extension

Tags:

html

websocket

I am trying to understand the purpose of websocket multiplexing extension, the main purpose what the document states is to use a single same origin physical websocket connection to the server while each browser tab uses a logical connection multiplexed on top of physical connection. I see another alternative using which we can accomplish this behavior today, the approach is to launch a shared web worker which opens the websocket connection and let each browser tab send and receive message to/from this worker. i have not tried this yet and i wonder will this work at all.

like image 449
kongaraju Avatar asked Jan 05 '13 05:01

kongaraju


People also ask

What is the advantage of WebSocket?

WebSockets are ideal for providing real-time transport and communication between AV-over-IP devices. For example, the BSS DCP-555 Template-Based Conferencing Processor uses a WebSocket connection in parallel with a standard TCP connection to allow configuration of meeting rooms via a web browser interface.

What is the purpose of WebSockets?

The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.

What is the purpose of WebSocket handshake?

WebSocket is a communications protocol for a persistent, bi-directional, full duplex TCP connection from a user's web browser to a server. A WebSocket connection is initiated by sending a WebSocket handshake request from a browser's HTTP connection to a server to upgrade the connection.


1 Answers

Your question reflects a misunderstanding of the problem the WebSocket Multiplexing Extension is trying to solve.

The base WebSocket spec (RFC 6455) defines a protocol for bi-directional exchange of data over TCP/IP. A WebSocket starts as a normal HTTP request / response. In this exchange, the client and server negotiate to switch to the WebSocket protocol. After the switch, the client and server exchange data frames over the TCP/IP connection. This creates a bi-directional data stream between client and server.

A drawback of the base protocol is that it supports only a single stream of data flowing in each direction. The multiplexing extension augments the base protocol, by allowing the client and server to create multiple "channels" over the same TCP/IP connection.

So the purpose of the multiplexing extension is to allow multiple WebSocket channels to run over the same TCP/IP connection. That's all.

Having multiple browser tabs (or web workers) share a single TCP/IP connection is just an example of how multiplexed websockets might be used. In standards terminology, it's just "informative" (descriptive), not "normative" (a required part of the spec).

like image 63
mstahl Avatar answered Sep 28 '22 17:09

mstahl