Skip to Content

Ports

TCP connections to ports on the host's loopback.

OperationKindHTTP
ports.connectstreamGET /v1/ports/{port}

ports.connect

A TCP connection to a port on the host's loopback, 127.0.0.1. The port is dialled first, so one that nothing listens on is an error and not a stream.

Host level only. A stream, as a subscription on the portal or a WebSocket of its own. It does not resume. Through rookery serve it needs the role operate.

Arguments

NameWhereRequiredDescription
portpathyesA TCP port on the host's loopback, 127.0.0.1: a number from 1 to 65535.

Frames from the server

FrameKindDescription
bytesbinaryWhat the program on the port sent.
eofJSONThe program on the port closed its side. Bytes sent towards it still arrive. The stream ends once both sides have sent this. Example: {"eof":true}

Frames to the server

FrameKindDescription
bytesbinaryBytes for the program on the port.
eofJSONThe client sends no more, and the program on the port reads the end. What it sends still comes back. Example: {"eof":true}
Request
{
  "id": 1,
  "op": "ports.connect",
  "args": {
    "port": "VALUE"
  }
}
Reply
{
  "id": 1,
  "result": {
    "open": true
  }
}

{
  "sub": 1,
  "data": {
    "eof": true
  }
}

// binary: 00 00 00 01, then the bytes

End the subscription with {"sub": 1, "end": true}.

On this page