Socket not sending correctly?

I am implementing the WebSocket specification since it doesn’t appears
that there are ANY server-side implementations that are not completely
outdated (draft 76 which expired 1 year ago…).

I managed to get the handshake, and I can receive messages from my
JavaScript client code, but I just can’t get my Ruby code to send
messages correctly.

It shouldn’t be hard at all, just have to follow the protocol here

, except no matter what I try it doesn’t work.

I even tried the simple example they give - sending “Hello” with the
following hexadecimal numbers - 0x81, 0x5, 0x48, 0x65, 0x6C, 0x6C, 0x6F.
I do this by simply sending them in a string

@socket.write(“\x81\x05\x48\x65\x6C\x6C\x6F”)

Yet that doesn’t work either, and if that doesn’t work, I can’t find any
reason beside Ruby failing to send the bits correctly.

The code MUST send 0x81 and 0x05 correctly, meaning:
10000001 00000101

Anyone has any ideas?

On Fri, Aug 19, 2011 at 6:18 PM, Chananya F. [email protected]
wrote:

, except no matter what I try it doesn’t work.
The code MUST send 0x81 and 0x05 correctly, meaning:
10000001 00000101

Anyone has any ideas?

Try socket.sync = true or even better use #flush.

Kind regards

robert