Skip to main content
Module

x/ddapps/messages.ts>IMPayload

Deno distributed applications framework
Latest
interface IMPayload
import { type IMPayload } from "https://deno.land/x/ddapps@1.6.5/messages.ts";

Interface used to type the payloads based on a Message type.

Type Parameters

optional
ReqPayload extends IRequestPayload = IRequestPayload

extends IRequestPayload used to type the ClientRequest

optional
ResPayload extends IResponsePayload = IResponsePayload

extends IResponsePayload used to type the ClientResponse & ClientNotification

Properties

[[EMType.Any]]: unknown

Send arbitrary data to a peer, to avoid

[[EMType.LogMessage]]: { message: string; detail?: unknown; }

Send a LogMessage, usually to the Logger

[[EMType.InitialMessage]]: null

Message sent by DDAPPS to all components just after the server started. Use it an initialisation hook

[[EMType.DiscoveryResult]]: { success: boolean; result: string; source: string; }

Emitted during the network initialisation to indicate whether a peer to join has been found. The message is always emitted even if --discovery is disabled

[[EMType.DiscoveryEndpointCalled]]: Deno.Addr

A peer exposes the /discovery endpoint that returns the peer IP (legacy) This message is sent to Logger to indicate a peer has call the endpoint (the remote peer is thus in the discovery phase)

[[EMType.ClientRequest]]: IClientRequest<ReqPayload>

Message sent by clients to formulate requests It contains the operation to perform

[[EMType.ClientNotification]]: IClientResponse<ResPayload>

Message sent to clients as a notification (client won't close connection on reception) It contains the operation that has been performed

[[EMType.ClientResponse]]: IClientResponse<ResPayload>

Message sent to clients to respond to requests It contains the operation that has been performed

[[EMType.ClientConnectionOpen]]: DClient<ReqPayload, ResPayload>

Indicates a Client has opened a connection to the server

[[EMType.ClientConnectionClose]]: string

A Client has closed the connection

[[EMType.PeerConnectionRequest]]: { peerIp: string; }

Connect to a peer

[[EMType.PeerConnectionOpen]]: { hostname: string; sock: WebSocket; }

A peer just opened a new connection

[[EMType.PeerConnectionSuccess]]: { peerIp: string; }

The connection to a peer succeeded (the WebSocket it opened)

[[EMType.PeerConnectionClose]]: string

The connection with a peer closed (the WebSocket closed)

[[EMType.PeerConnectionAccepted]]: { knownPeers: string[]; }

Indicates to a peer that its incoming connection has been accepted. It provides a list of other peers to connect to

[[EMType.MonGetRequest]]: IMonOp

Fetch a monitoring value (from state, or not, see the Monitor implementation)

[[EMType.MonGetResponse]]: IMonOp

Return a value from the state (or other source like Deno.metrics())

[[EMType.MonSetRequest]]: IMonOp

Set a state value

[[EMType.MonSetResponse]]: IMonOp

Confirm a MonSetRequest

[[EMType.MonWatchRequest]]: IMonWatch

Get notified when a monitoring value changes. Monitor will send ClientNotification to notify the initiator

[[EMType.InvalidMessageDestination]]: { invalidMessageDestination: EComponent | string; availablePeers: string[]; availableClients: string[]; }

When a message destination is an IP or a Hostname, the Net will try to send it on the network This message is emitted if Net didn't find the corresponding Client or RemotePeer

[[EMType.InvalidClientRequestType]]: IClientRequest<ReqPayload>

Currently only used by Client but not emitted by server Indicates that the Client formulated an invalid ClientRequest