valum-framework/valum

WebSocket backend for VSGI

arteymix opened this issue · 2 comments

Currently, libsoup-2.4 supports the WebSocket protocol and we could very well provide a server implementation that would use it as a transport layer. Once the handshake is initiated, the body streams would become suitable for passing messages.

Each flushed write_all (e.g. append and append_utf8) would become a message and we could extend the current request API to read a "chunk" of data.

It could even be more generic in the sense that the protocol could promote the current I/O stream as a websocket connection and have WebSocket for any implementation that can bear a high TTL.

app.get ("/", ws ((req, res, next, ctx, ws) => {
    ws.send_text ("message");
}));

The rest of the work will go in #206