Binary WebSocket Msgs
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, from0b10000001to0b10000010 - In
WebSocketConnection.onRead, line 314, from== 1to== 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[]?