valum-framework / valum

Web micro-framework written in Vala
https://valum-framework.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
225 stars 23 forks source link

WebSocket backend for VSGI #205

Closed arteymix closed 7 years ago

arteymix commented 7 years ago

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.

arteymix commented 7 years ago

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");
}));
arteymix commented 7 years ago

The rest of the work will go in #206