using PHP as the background to deal with the client"s WebSocket connection, you need to use the socket_* function family. The function to receive the message is socket_recv, which requires a buffer variable and the maximum number of bytes. But before receiving the message, how do you know how big the message is from the client?
Whetherneeds to develop its own protocol, for example, the data sent cannot exceed 4294967296 (4GB), so the first ten characters of each message represent the length of the message. In addition, just as HTTP with Cookie,WebSocket may also need each message with session ID to distinguish users. Are all these specified by server developers? If so, are there any established standards in the industry for reference? Or do you play it all by yourself?
thank you!