📖 WIPIVERSE

🔍 Currently registered entries: 103,062건

BOSH (protocol)

BOSH (Bidirectional-streams Over Synchronous HTTP) is an XMPP extension protocol defined in RFC 6121 and RFC 6120. It provides a transport method for XMPP (Extensible Messaging and Presence Protocol) messages over HTTP. BOSH allows XMPP clients, typically web browsers or other HTTP-constrained environments, to communicate with an XMPP server using a long-lived, persistent HTTP connection. This avoids the need for dedicated TCP connections or continually re-establishing HTTP connections, which can be inefficient and problematic in certain network environments (e.g., those with restrictive firewalls).

The core idea behind BOSH is to emulate a bidirectional stream of data over HTTP. It achieves this by using HTTP's request-response model in a clever way. The client sends an HTTP request to the server, which the server holds open until it has data to send back to the client. When data is available, the server responds to the client's request. The client immediately sends another request, which the server again holds open. This creates a persistent, virtual connection that allows for near real-time communication.

BOSH works by encapsulating XMPP stanzas (the basic units of data in XMPP) within an HTTP request body. The client sends stanzas to the server in a <body/> element. The server, in turn, responds with its own <body/> element containing stanzas destined for the client.

Key characteristics of BOSH include:

  • Bidirectional Communication: Enables two-way communication between client and server, essential for XMPP's interactive nature.
  • HTTP-Based: Uses standard HTTP, making it compatible with existing web infrastructure and firewalls.
  • Long-Lived Connections: Maintains persistent connections, reducing overhead compared to repeatedly opening and closing connections.
  • Polling Mechanism: Uses a polling-like technique where the client essentially asks the server repeatedly if there is any new data.
  • Session Management: Manages a session between the client and server, handling disconnections and reconnections.

BOSH is often used in web-based XMPP clients, enabling real-time messaging and presence features within web applications. It provides a practical solution for integrating XMPP functionality into environments where direct TCP connections are not feasible or desirable.