← 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
| Field | Type | Required | Default | Description |
|---|
address | string | yes | | The address of the remote peer |
transport | "http" | "websocket" | "local" | no | | The transport to use |
timeout | integer | no | | The connection timeout in milliseconds |
Output
| Field | Type | Required | Default | Description |
|---|
connectionId | string | yes | | The id of the connection: server.call and server.disconnect take it |
remotePeerId | string | yes | | The id of the remote peer |
remoteProcedures | object[] | yes | | The 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": {}
}
}