WebSocket

The WebSocket plugin adds a WebSocket server to PicoTorrent where torrent updates are broadcasted to connected clients. It is currently unprotected and therefore not suitable for internet traffic.

Configuring the WebSocket

Configuration is stored in the PicoTorrent.json file.

1
2
3
4
5
6
7
8
9
{
  "websocket": {
    // Set to `true` to enable the WebSocket plugin.
    "enabled": false,

    // The port which the WebSocket server will listen on.
    "listen_port": 7676
  }
}

Messages

The message API is JSON based and each message contains the type hash which tells the consumer what type of message it is.

The first message sent is the pico_state message, which contains the full state for PicoTorrent.

Objects

Each message may contain one or more well-defined objects.