Skip to main content

Module shard_ws

Module shard_ws 

Source
Expand description

Bidirectional WebSocket server for real-time shards.

Runs on its own port (typically pylon_port + 3). Each connection:

  1. Parses the request path for ?shard=<id>&sid=<subscriber>.
  2. Looks up the shard in the DynShardRegistry.
  3. Runs the subscribe authorization hook.
  4. Registers a [SnapshotSink] that writes binary frames to the socket.
  5. Reads text/binary frames from the client and pushes them as inputs.
  6. Cleans up on disconnect.

Each client gets its own dedicated thread. For larger deployments, swap in an async runtime; for pylon’s current scale, thread-per-conn is simpler and fine.

Functions§

start_shard_ws_server
Run a WebSocket server that accepts shard connections.