Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger websocket frame fragmentation from the client?

Tags:

websocket

I'm building a Web socket server, however, for testing purposes, I'd like Chrome or Firefox or any other browser to send the message fragmented so I can test my implementation.

I've tried even sending 100K text data and the FIN flag is always set to 1 and the opcode is TEXT.

Is there a way to manually trigger fragmented frames? Any client out there with more flexibility?

like image 397
Sijia Din Avatar asked Oct 31 '22 06:10

Sijia Din


1 Answers

The Javascript WebSocket API does not expose this option. I recently ran into the same frustration when some more modern browsers (A Chromium derivative) was unpredictably sending fragmented WebSocket frames.

For testing I rolled my own TCP client sending pre-calculated fragmented WebSocket frames. Not ideal, but it got the job done, and AFAIK there's no alternative yet.

like image 133
Martin Cowie Avatar answered Jan 04 '23 14:01

Martin Cowie