Currently Lighttp does not work with binary messages, only text messages. It assumes outgoing msgs are text, and ignores incoming binary msgs.
According to the WebSocket spec, found here, page 28:
- %x1 denotes a text frame
- %x2 denotes a binary frame
To change your code to work only with binary simply change:
- In
WebSocketConnection.send, line 341, from 0b10000001 to 0b10000010
- In
WebSocketConnection.onRead, line 314, from == 1 to == 2
Obviously that is not a good fix.
Vibe.d has a receiveBinary and a receiveText, and overloads send with const(char)[] and const(ubyte[]) respectively.
Given that Lighttp uses a callback style, I recommend adding overloads to WebSocketConnection.send and WebSocketConnection.onReceive. It will be a breaking change, given that the current binary-signatured functions will actually send binary, not text.
I can make a Pull Request. Any reason why WebSocketConnection.send takes a void[] and not a ubyte[]?
Currently Lighttp does not work with binary messages, only text messages. It assumes outgoing msgs are text, and ignores incoming binary msgs.
According to the WebSocket spec, found here, page 28:
To change your code to work only with binary simply change:
WebSocketConnection.send, line 341, from0b10000001to0b10000010WebSocketConnection.onRead, line 314, from== 1to== 2Obviously that is not a good fix.
Vibe.d has a
receiveBinaryand areceiveText, and overloadssendwithconst(char)[]andconst(ubyte[])respectively.Given that Lighttp uses a callback style, I recommend adding overloads to
WebSocketConnection.sendandWebSocketConnection.onReceive. It will be a breaking change, given that the current binary-signatured functions will actually send binary, not text.I can make a Pull Request. Any reason why
WebSocketConnection.sendtakes avoid[]and not aubyte[]?