registry.relay¶
Relays an RPC call to a specific device through the registry server. This is used when two devices have not yet established a direct connection.
Request¶
| Field | Value |
|---|---|
| Method | registry.relay |
| Return Method | (empty string) |
| Arguments | 2 |
Arguments¶
| # | Type | Description |
|---|---|---|
| 1 | BMRegistryInfo |
The target device to relay the message to. |
| 2 | BMInvoke |
The RPC call to forward to the target device. |
The return method is an empty string because relay messages are fire-and-forget from the sender's perspective. The response, if any, comes from the target device via a separate relay or direct connection.
Primary Use Case: deviceConnectRequested¶
The main use of registry.relay is to initiate a direct connection between a controller and a game host:
- The controller selects a game host from the list received via
onList. - The controller calls
registry.relaywith:- Target: The selected host's
BMRegistryInfo. - Payload: A
BMInvokecallingdeviceConnectRequestedwith the controller's ownBMRegistryInfoas the argument.
- Target: The selected host's
- The registry server forwards this
BMInvoketo the game host. - The game host receives the
deviceConnectRequestedcall, opens a direct TCP connection to the controller using the address from the relayedBMRegistryInfo, and sends an AckPacket over the new direct connection.
sequenceDiagram
participant Controller
participant Server as Registry Server
participant Host as Game Host
Controller->>Server: registry.relay(HostInfo, deviceConnectRequested)
Server->>Host: deviceConnectRequested(ControllerInfo)
note over Host,Controller: Direct Connection Initiated
Host->>Controller: TCP Connect to Controller IP
Host->>Controller: Handshake
Host->>Controller: AckPacket (Channel 0)
Notes¶
- The relay payload is a nested
BMInvokeinside the outerregistry.relayinvoke. See BMInvoke for the wire format. - The registry server does not interpret the relayed
BMInvoke; it simply forwards it to the target device.