OptionalpeerName: stringWhether this connector is setting up or has finished setting up its connection and is ready to communicate on the network
Readonly ExperimentalonNever fires here. Only the process that owns the websocket server sees a connection being lost; this end of the seam exists so shared code can subscribe in any process without asking which one it is running in.
Readonly ExperimentalonFires when this client's established websocket closes without the app having asked it to. A socket that dies before it ever opened is a failed connection attempt rather than a loss, and is silent here. See IRpcMethodRegistrar.onDidLoseConnection.
Sets up the RPC handler by populating connector info, setting up event handlers, and doing one of the following:
An implementation that opens an endpoint MUST NOT resolve true until that endpoint is
actually accepting connections. Callers treat this resolving as permission to start processes
that immediately connect, and those clients may get a single attempt with no retry — so
reporting ready optimistically surfaces as a client that was refused, whose symptoms appear in
a different process entirely. See adr-papi-websocket-hostname-bind.
Function that handles events from the server by accepting an eventType and an event and emitting the event locally. Used when receiving an event over the network.
true once the connection is established and usable — for a server, once its endpoint
is accepting connections. false if the connection could not be established.
TODO(PT-4495): implementations disagree on what they return when this handler was already connected or connecting, so a caller can neither rely on that case nor tell a benign double-connect from a real failure. PT-4495 replaces the boolean with a result type that distinguishes the three outcomes; until then, only the two states above are contractual.
Disconnects from the connection:
Sends an event to other processes. Does NOT run the local event subscriptions as they should be run by NetworkEventEmitter after sending on network.
Unique network event type for coordinating between processes
Event data to emit on the network
Register a centrally-tracked network event with the main process. Multi-source vs single-source
semantics is determined by looking up the event name in MULTI_SOURCE_EVENT_NAMES. See
MultiSourceNetworkEvents for multi-source vs single-source semantics.
Returns true if the registration was accepted, false otherwise. Used by
createNetworkEventEmitterAsync; not for direct caller use.
Optionaldocumentation: SingleNotificationDocumentationRegister a method that will be called if an RPC request is made
OptionalmethodDocs: SingleMethodDocumentationSend a request and resolve after receiving a response
Type of request (or "method" in JSONRPC jargon) to call
Parameters associated with this request
Promise that resolves to a JSONRPCSuccessResponse or JSONRPCErrorResponse message
Unregister a network event emitter so it is no longer tracked centrally
Unregister a method so it is no longer available to RPC requests
Manages the JSON-RPC protocol on the client end of a websocket that connects to main
Created by any process that connects to the websocket server owned by main