Eric Pigeon
Eric Pigeon

Reputation: 1131

websockets firefox on close or refresh

I am playing around writing a websocket server in node.js. When testing in firefox, on refresh or page close, firefox seems to be sending random data, I have my server writing the data to std out and it seems to be different non printable characters every time. Is this really random data, or something I am just no aware of. I haven't been able to find any information on the closing handshake on websockets, but surely there must be something about this data.

Upvotes: 1

Views: 763

Answers (1)

sarnold
sarnold

Reputation: 104040

The Websockets CLOSE frame includes a two-byte network-order integer and an optional "descriptive" portion that need not be human readable. If you're writing the two-byte integer to standard out and treating it as two ASCII characters or UTF-8 characters, chances are good it'll just look like garbage.

Upvotes: 2

Related Questions