← All procedures

server.connect

Connect to a remote peer for bidirectional RPC

CLI
Package
@procedures/peer · README
Path
["server","connect"]
CLI
mark server connect --address <string>
As data
{"$proc":["server","connect"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/peer"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["server","connect"], { address: "<address>" });
console.log(JSON.stringify(result));

From the command line

$ mark server connect --address <string>

As data, in a program

{ "$proc": ["server", "connect"], "input": { "address": "<address>" } }

Input

FieldTypeRequiredDefaultDescription
addressstringyesThe address of the remote peer
transport"http" | "websocket" | "local"noThe transport to use
timeoutintegernoThe connection timeout in milliseconds

Output

FieldTypeRequiredDefaultDescription
connectionIdstringyesThe id of the connection: server.call and server.disconnect take it
remotePeerIdstringyesThe id of the remote peer
remoteProceduresobject[]yesThe procedures of the remote peer
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "address": {
        "type": "string",
        "minLength": 1,
        "description": "The address of the remote peer"
      },
      "transport": {
        "description": "The transport to use",
        "type": "string",
        "enum": [
          "http",
          "websocket",
          "local"
        ]
      },
      "timeout": {
        "description": "The connection timeout in milliseconds",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "address"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "connectionId": {
        "type": "string",
        "description": "The id of the connection: server.call and server.disconnect take it"
      },
      "remotePeerId": {
        "type": "string",
        "description": "The id of the remote peer"
      },
      "remoteProcedures": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "path": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The procedure path"
            },
            "description": {
              "description": "The description of the procedure",
              "type": "string"
            },
            "inputSchema": {
              "description": "The JSON Schema of the input",
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            },
            "outputSchema": {
              "description": "The JSON Schema of the output",
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "path"
          ],
          "additionalProperties": {}
        },
        "description": "The procedures of the remote peer"
      }
    },
    "required": [
      "connectionId",
      "remotePeerId",
      "remoteProcedures"
    ],
    "additionalProperties": {}
  }
}