Websocket vs HTTP

Telemetry applications like Browsee often require frequent data updates from the client to a server. Therefore, the question of whether to use plain old HTTP calls or Websockets becomes imperative from a performance point of view.

Based on the considerations below, we chose to use Websockets because its much faster and overhead efficient compared to HTTP calls for our user case.

So let's look at the factors that went into this study.


  1. Frequency of Updates: Collecting user interaction data like clicks, mouse trail requires fast frequent transfer of data. Most of it is one way. The data transfer request pattern typicall looks something like this.
User Timeline
Data Transfer at Page Load and User Actions interspersed with inactivity

As you can see this data transfers tend to happen at page loads (or session starts in case of SPAs) or when a user interacts with the page. A lot of if it is unpredictable but with each interaction mulitple unrelated data points may trigger, like mouse clicks, as well as network call data resulting from the click. Often, its not possible to wrap them together and send via HTTP, so Websocket make more sense as we can transfer data as and when it is originated without having to worry about efficiently packing them together in a single request.

2. Number of Requests: As an excercise our team picked some random sessions from user trails and counted the number of data events on each page. We found that this number can vary anywhere from 100-500 in case of an interactive session and upto 100 in case of mildly interactive or bounced sessions. However, since the interactive sessions are more important for us to understand and collect data from, we have assumed over 100 requests of 500 bytes each as our reference.

As per the performance study by Arun Gupta [2], these were the respective performances

Performance Graph

And this was the underlying comparison

Performace Table
For our usecase Websockets are about 5 to 7 times faster

As is clear from the table, for our use case Websocket is expected to be about 5-7 times faster than plain HTTP.

3. Security: From security perspective, both HTTP (via HTTPS) and Websockets via (WSS) provide the TLS layer so there is not much to choose from.


Websockets provided much faster and efficient data transfer for recording user sessions and interactions which is the foundation of UX research tools like Browsee and hence we have based our client side technology on Websockets.


  1. When to use a HTTP call instead of a WebSocket (or HTTP 2.0)
  2. REST vs WebSocket Comparison and Benchmarks
  3. HTTP vs Websockets: A performance comparison
  4. Image by Vecteezy