Skip to main content
Module

x/msgpack_rpc/mod.ts>Session

🦕 Deno module to support msgpack-rpc
Latest
class Session
implements Disposable
import { Session } from "https://deno.land/x/msgpack_rpc@v4.0.0/mod.ts";

MessagePack-RPC Session

Constructors

new
Session(
writer: Deno.Writer,
dispatcher?: Dispatcher,
options?: SessionOptions,
)

Properties

dispatcher: Dispatcher

API name and method map which is used to dispatch API request

Methods

private
dispatch(method: string, ...params: unknown[]): Promise<unknown>
private
handleNotification(notification: message.NotificationMessage): Promise<void>
private
handleRequest(request: message.RequestMessage): Promise<void>
private
handleResponse(response: message.ResponseMessage): void
private
listen(): Promise<void>
private
send(data: Uint8Array): Promise<void>
call(method: string, ...params: unknown[]): Promise<unknown>

Call a method with params and return a Promise which resolves when a response message has received and to the result value of the method.

Clear an internal dispatcher

close(): void

Close this session

extendDispatcher(dispatcher: Dispatcher): void

Extend an internal dispatcher

notify(method: string, ...params: unknown[]): Promise<void>

Notify a method with params and return a Promise which resolves when the message has sent.

waitClosed(): Promise<void>

Wait until the session is closed