A browser can communicate with the Barracuda App Server (BAS) through ordinary HTTP requests, a persistent WebSocket connection, or Simple Message Queue (SMQ).
| Model | Use it when | Tradeoff and guide |
|---|---|---|
| HTML form submission | The server can return a complete page after each operation. | Requires little client-side JavaScript. Start with HTML Forms and LSP for Beginners. |
| Fetch and JSON or HTML fragments | The browser should update part of a page without a full reload. | Each operation remains an HTTP request, which keeps the API easy to inspect and test. See AJAX for Beginners. |
| REST-style HTTP API | Browsers, devices, gateways, or test tools need resource-oriented operations and standard HTTP status codes. | Works with common HTTP tooling. See the REST tutorials for Lua and C and C++. |
| WebSocket request-response | The application exchanges frequent messages in both directions and benefits from one persistent connection. | The application must define message correlation, reconnect behavior, and error handling. See AJAX over WebSockets. |
| SMQ publish/subscribe | Multiple browsers or devices subscribe to live events, or the server targets individual clients and topics. | SMQ supplies topic routing and sender identity above WebSockets. Start with the SMQ overview. |
| Remote procedure call (RPC) over SMQ | The UI needs request-response calls and real-time events over the same SMQ connection. | The RPC layer is an example library rather than a REST interface. See the SMQ RPC example. |
Start with forms or Fetch when interactions are occasional and request-response semantics fit the application. Use WebSockets when the browser and server exchange frequent bidirectional messages. Add SMQ when the application also needs topics, subscriptions, one-to-one messages, or coordination among multiple connected clients.
Persistent connections can reduce repeated connection setup, but actual latency and resource use depend on the network, TLS session behavior, message rate, server configuration, and client implementation. Measure the deployed system before choosing one model solely for performance.