简体   繁体   中英

Can browser split up payload data into multiple websocket frames?

In javascript below i send up to 200 bytes through websocket (after connecting and handshaking ):

     buf= new Uint8Array(200);
     /* filling buf with data*/
     ws.send(buf.buffer);

On the other side there is a simple iocp c++ server, which receive these 200 bytes preceded by few bytes of websocket frame.

Can i assume that browser always send these 200 bytes(+ websocket head) in one piece? Or should I always on server side check if this is final frame (by checking first bit in websocket head)?

thanks in advance for yours tips.

您应该始终检查FIN位,根据RFC6455,浏览器很可能会拆分有效负载(取决于Web套接字框架的某些上限)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM