Reactive end-to-end
An incoming message updates a $x — the DOM follows, no manual subscription, no extra plumbing.
The socket talks directly to your reactive $ state — reconnection and session resume included, rooms, presence, streams, and typed request/response.
An incoming message updates a $x — the DOM follows, no manual subscription, no extra plumbing.
room(), reactive presence, and per-room history — join, broadcast, and see who's there, batteries included.
Token refresh in flight, automatic anti-entropy resync, and sessionExclusive (true/'replace'/'refuse') for single-session identities.
$Below is a real, honest simulation: no server involved — just a timer pushing fake messages into a reactive list, so you can feel the shape of the API.
<script> @sock = µsocket "wss://jeu/play" @sock.on 'chat', (p)-> $messages.push(p) </script> <button @click={@sock.send 'chat', texte: $texte}> Send </button>
Waiting for the first message…
Fan-out figure: internal server bench, not yet in the published reference docs — read as indicative.
sock.request() resolves a Promise from the server's µ:ack.
Numbered deltas with automatic catch-up on drop.
A reactive store of who is here — global or per room.
room() with scoped broadcast and optional history.
A micro-drop is buffered and replayed right after µ:welcome.
One connection per identity — true/'replace'/'refuse'.
Any existing back-end pushes real-time with a signed HTTP POST.
Interpolates jerky network positions at display frequency.
| Criterion | MJS-WS | Socket.IO | Meteor | Raw WebSocket |
|---|---|---|---|---|
| Reconnect + session resume | ✓ | reconnect only | reconnect only, no replay | manual |
| Rooms / presence | ✓ | rooms only | pub/sub | none |
| Binary with schema | ✓ | no | no (EJSON text) | manual bytes |
| Reactive front integration | ✓ | no | ✓ | no |
| Weight | shared with the MJS runtime | ~35 KB | full framework | 0 KB (native) |
Figures are indicative and meant to be honest, not promotional.
One command to get the framework.
npm install mjs-frameworkThe core + only the modules you use:
mjs.config.json"runtime": ["socket", "schema", "smooth"]