Skip to main content

WebSocket

Implementation

Sequence Diagram

You can use WebSocket strategy in order to implement TrustFactor for real-time communications. Your implementation would be something like this:

Transaction diagram with WebSocket strategy - Fig. 1

Infrastructure

Polling Infrastructure

Infrastructure diagram with WebSocket strategy - Fig. 2

Pros and Cons

This strategy has good performance since the application will push the update to the user via WebSocket in realtime, but your infrastructure is somewhat vulnerable since it will receive ingress communications that won't go through a Web Application Firewall.

Difficulties

Like polling strategy, you won't be able to keep data in application's memory since the next request might be handled by a different replica. You will need to use an external storage to help keep all replicas in-sync like Redis and pass information from one replica to another.

Also, it is much harder to handle WebSockets server scalability and communications high availability.