Web Socket
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.
Drawbacks of XHR
- Header needs to be sent on each communication via HTTP
- Slow and polling might be required
Web Sockets flow
- Web browser can initiate a persistent connection
- Web browser can engage in bidirectional conversations between web browsers and servers
- Web browser can send message to web server
- Web server can also initiate a conversation and send messages to the web browser
- No headers needed hence reduced message overhead: This is because of frame based data exchange approach
- Using web sockets message order is not guaranteed
STOMP
- Simple Text Oriented Messaging protocol
- Application level subprotocol compared to Web Sockets which is low level protocol
- Some methods include:
connect()subscribe()send()onmessage()
SockJS
- SockJS is a cross-browser JavaScript library that provides a WebSocket-like object
Client Side Sockets
Some popular libraries are:
- SockJS (Application level)
- Socket.io (Application level)
- Engine.io (Low level)
Testing Sockets
Client side testing libraries:
- Artillery
Server side testing libraries:
- Junit
Full Load Performance Testing:
- Apache Jmeter