class Session
implements Disposable
import { Session } from "https://deno.land/x/msgpack_rpc@v4.0.1/mod.ts";
MessagePack-RPC Session
Constructors
new
Session(reader: Deno.Reader & Deno.Closer,
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): voidprivate
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.
clearDispatcher(): void
Clear an internal dispatcher
close(): void
Close this session
dispose()
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