Understanding Server-Side Web Sites

I have some questions in understanding the connection with websocket. AFAIU, on the client side, works as follows:

  • From the client, a new Socket handler is created using the "new WebSocket (" ws: // blahblah ")"
  • Then, using the onOpen () method, it is known that we are connected to the WS server
  • Using the onMessage () metthod, it is known that the message was received from WS Server
  • The OnClose () method determines that the socket connection is closed.

So, from the point of view of the client this is understandable. But from the point of view of the server, how the flow is going (as indicated above for the client) and what exactly does the websocket server process mean, and what exactly do we mean when the connection occurs on TCP and how we check it (my aplologies, if the question is very simple )

Can someone explain. Thanks at advannce

+3
source share
2 answers

On the server side, it really depends on the implementation, language and API of the websockets library, or you use your implementation.

This description is relevant only for the implementation of RAW Web applications and is not based on the use of any libraries for working with the WebSockets protocol. Libraries such as jWebSockets (Java), SignalR, socket.io and others will have completely different processes for working with WebSockets.

If we are talking about raw implementation in raw sockets, then the process is this:

  • TCP- , , . . .Net , , , . 1. , JS: WebSocket (...);
  • . TCP , .
  • WebSockets , HTTP- - , . , , , - - .
  • . , WebSocket. 4b. (), "onopen", "onerror" "onclose" .
  • , , . ( ) WebSockets. WebSockets - MESSAGE. , .
  • , , TCP. 2 , (2 ) - , , , . . . 2 , . , , TCP. , , ( , ), . , .
  • , , , , , "socket.send("... ");".
  • , , UTF8, , , , , . , .
  • , , , "onmessage" , .

. , , , . TCP. .

.

WebSockets RFC 6455, , iOS , , .

+4

All Articles