What is BOSH?
Bidirectional-streams Over Synchronous HTTP (BOSH) is a transport protocol that creates bi-directional TCP connectivity between client and server. It achieves this by utilizing multiple synchronous HTTP request/response pairs without requiring the use for chunking.
The BOSH protocol is sometimes referred to as HTTP Long Polling, which occurs when a client sends a request to a server, the server does not respond immediately as it gathers data to send back. As the server is gathering data, the connection remains stable and if the server is unable to gather specific information, the server responds with an empty. As this occurs, a client is left with no other choice but to repeat the request, hence, the term “Long Polling.”
The Bosh protocol provides multiple advantages as a transport protocol, including:
- Low latency when re-establishing connections after timeout, which allow BOSH communication with servers to be much more efficient than that of WebSockets.
- Every request contains HTTP and response headers and each request contains XML with session-related attributes.
- The protocol has allowed XMPP to become more efficient.