UNPKG

ws-rmi

Version:

A Remote Method Invocation implementation written in JavaScript utilising the WebSocket protocol

32 lines (31 loc) 1.11 kB
import { RMIMessage } from "./RMIMessage"; /** * Represents a request made to a remote RMI server. */ declare type RMIRequestData = { /** * The name of the function that will be invoked on the remote RMI server. */ target: string; /** * Arguments that will be provided to the function invoked on the remote RMI server. */ args: unknown[]; }; /** * Represents a request to the remote to invoke a function. */ export declare type RMIRequest = RMIMessage<"REQUEST", RMIRequestData>; /** * Creates an object adhering to the RMI Request schema. * * @param id The ID to uniquely identify the RMI Result that the remote sends back. * @param target The target function to be invoked. * @param args The function arguments to be invoked in the remote. */ export declare const createRMIRequest: (id: string, target: string, args: unknown[]) => RMIRequest; /** * Validates that the given message is an RMI Request. */ export declare const validateRMIRequest: (message: unknown) => message is RMIMessage<import("./RMIMessageType").RMIMessageType, RMIRequestData>; export {};