← All procedures

server.call

Call a procedure on a remote peer through an outbound connection

CLI
Package
@procedures/peer · README
Path
["server","call"]
CLI
mark server call --path <string | string[]>
As data
{"$proc":["server","call"],"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","call"], { path: "<path>" });
console.log(JSON.stringify(result));

From the command line

$ mark server call --path <string | string[]>

As data, in a program

{ "$proc": ["server", "call"], "input": { "path": "<path>" } }

Input

FieldTypeRequiredDefaultDescription
connectionIdstringnoThe connection id from server connect
addressstringnoThe address of a peer, for a one-time connection
pathstring | string[]yesThe procedure path on the peer: dot-separated text or a list
inputanynoThe input of the remote procedure

Output

FieldTypeRequiredDefaultDescription
resultanyyesThe result of the remote procedure
connectionIdstringyesThe connection that the call used
pathstring[]yesThe path of the remote procedure
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "connectionId": {
        "description": "The connection id from server connect",
        "type": "string",
        "minLength": 1
      },
      "address": {
        "description": "The address of a peer, for a one-time connection",
        "type": "string",
        "minLength": 1
      },
      "path": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "description": "The procedure path on the peer: dot-separated text or a list"
      },
      "input": {
        "description": "The input of the remote procedure"
      }
    },
    "required": [
      "path"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "result": {
        "description": "The result of the remote procedure"
      },
      "connectionId": {
        "type": "string",
        "description": "The connection that the call used"
      },
      "path": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The path of the remote procedure"
      }
    },
    "required": [
      "result",
      "connectionId",
      "path"
    ],
    "additionalProperties": {}
  }
}