- passing all autobahn tests
- handles per message deflate, including sliding window bits size negotiation
- uses zlib for message compression/decompression
There is a minimal project in examples/exe which demonstrates how to use websocket client.
- add dependency to ws lib in your build.zig.zon
- link library in your build.zig
Then you can @import("ws")
in src/main.zig.
This example uses public echo ws server at ws://ws.vi-server.org/mirror/.
Connects to websocket server, sends hello message and prints echoed reply.
Above url is taken from websocat - curl for WebSocket tool.
You can start websocat server locally with for example:
websocat -s 8080
and then connect to it by changing hostname, uri, port to:
const hostname = "localhost";
const uri = "ws://localhost/";
const port = 8080;
The WebSocket Protocol RFC
compression extension RFC
autobahn testsuite
zig test src/main.zig --deps zlib=zlib --mod zlib::../zig-zlib/src/main.zig -l z 2>&1 | cat