1- What is WebSocket?
WebSocket is a communication protocol, which helps establish a two-way communication channel between client and server. A communication protocol that you are familiar with is HTTP, and now, we will compare the characteristics of these two protocols:
HTTP (Hypertext Transfer Protocol): a request-response protocol. When Client (Browser) wants something, it will send a request to the Server, and the Server responds such request. HTTP is a one-way communication protocol. The purpose herein is to solve "How do you do to create a request at the client, and how do you to respond the request of the client", and this is reason so that the HTTP shines.
WebSocket is not a request-response protocol, where only Client can send a request to the Server. When a connection with WebSocket protocol is established, client & server can give data to each other, until the lower layer connection such as TCP is closed. The WebSocket is basically similar to the TCP Socket concept. The difference is that the WebSocket is created to use for Web applications.
STOMP
STOMP (Streaming Text Oriented Messaging Protocol): a communication protocol, a branch of the WebSocket. When the client and the server contact each other by this protocol, they will send each other text message data. The relationship between STOMP and WebSocket is also similar to the one between HTTP and TCP.
In addition, the STOMP also provides a specific way to solve the following functions:
Function | Description |
Connect | Provide ways so that the client and the server can connect to each other. |
Subscribe | Provide ways so that the client subscribes receipt of messages of a topic. |
Unsubscribe | Provide ways so that the client unsubscribes the receipt of messages of a topic. |
Send | How the client sends messages to the server. |
Message | How to send a message sent from the server to the client. |
Transaction management | Transaction management during data transfer (BEGIN, COMMIT, ROLLBACK,...) |
ليست هناك تعليقات:
إرسال تعليق