Commitceebd25cRecorded29 Mar 2026Repositorysigil-websocket

Add README

Changed
 README.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
Diff
README.mdadded
@@ -0,0 +1,62 @@
+1
# sigil-websocket
+2
+3
A [Sigil](https://codeberg.org/sigil/sigil) library for WebSocket client connections (RFC 6455). Supports both `ws://` and `wss://` (TLS) with cooperative non-blocking I/O.
+4
+5
## Features
+6
+7
- **TLS support** -- connect to `ws://` and `wss://` endpoints
+8
- **Frame encoding/decoding** -- text, binary, ping, pong, close
+9
- **Client masking** -- automatic frame masking per RFC 6455
+10
- **Fragmentation** -- transparent message reconstruction from continuation frames
+11
- **Cooperative I/O** -- non-blocking receive that yields to the scheduler
+12
+13
## Usage
+14
+15
Add `sigil-websocket` as a dependency in your `package.sgl`:
+16
+17
```scheme
+18
(from-git url: "codeberg:sigil/sigil-websocket" package: "sigil-websocket")
+19
```
+20
+21
Then connect and exchange messages:
+22
+23
```scheme
+24
(import (sigil websocket))
+25
+26
(define ws (ws-connect "wss://echo.websocket.org"))
+27
+28
(ws-send ws "Hello, WebSocket!")
+29
+30
(let loop ()
+31
(let ((msg (ws-receive ws)))
+32
(when (string? msg)
+33
(display msg)
+34
(loop))))
+35
+36
(ws-close ws)
+37
```
+38
+39
## Modules
+40
+41
| Module | Description |
+42
|--------|-------------|
+43
| `(sigil websocket)` | Top-level re-exports |
+44
| `(sigil websocket frame)` | Frame encoding, decoding, masking |
+45
| `(sigil websocket connection)` | Handshake, send, receive, close |
+46
+47
## Dependencies
+48
+49
- sigil-stdlib
+50
- sigil-socket
+51
- sigil-crypto
+52
+53
## Building
+54
+55
```bash
+56
sigil build --redirects dev-redirects.sgl
+57
sigil test
+58
```
+59
+60
## License
+61
+62
BSD-3-Clause