user2118704
user2118704

Reputation: 55

Can a websocket message be intentionally split?

I am working on a server and finished the handshake and basic websocket unmasking functions (the server is go!). I am wondering how I could test my fragment handling code. Is there a way to, with chrome, create a websocket, connect to my local server, and then split "hello" into 2 frames. I was able to send "hello" and see it on the server. Sending hello twice was just 2 messages with fin bits.

Upvotes: 1

Views: 2258

Answers (1)

Thundercat
Thundercat

Reputation: 121129

The Gorilla client sends fragmented messages when the message size is greater than the write buffer size.

The AutoBahn Test Suite includes tests for fragmented messages. You can use the Gorilla test server for Autobahn as a starting point for your tests.

Another option is to use the tested Gorilla websocket package instead of writing your own websocket code.

Upvotes: 1

Related Questions