Polling/long polling. Drawbacks
1) Network overhead
a) SSL handshake can be initiated each time, and it is expensive
2) User presence tracking is complicated
3) In case of load balancer, each time user will be connected to
WebSocket vs REST approach
1) Each URL mapped to resource
2) Each HTTP method has predefined semantics
1) Single URL for handshake
2) No predefined semantics
What does it mean?
Communications via WebSocket is much closer
to messaging approach*
But no concrete messaging protocols are defined
1) WAMP – provides RPC + messaging features.
2) STOMP – provides messaging features only. Can be easily integrated
with message brokers like ActiveMQ, RabbitMQ etc.
3) 20+ other subprotocols
What if you want connect directly to external message
broker and put message there, not via WebSocket endpoint?
It is impossible with current Spring architecture. Workarounds required.
1) WebSocket is standardized technology for bidirectional data
exchange in web.
2) WebSocket is fast and low latency
3) Spring 4+ easily integrates with websockets using STOMP
4) Spring 4+ internal architecture is not ideal