@tracerbench/protocol-transport
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@tracerbench/protocol-transport

Adapts a AttachMessageTransport function defined in @tracerbench/message-transport into an AttachProtocolTransport<SessionId> function which is used to create a send function.

export type AttachProtocolTransport<SessionId> = (
  onEvent: OnEvent,
  onError: OnError,
  onClose: OnClose,
) => [
  AttachSession<SessionId>,
  DetachSession<SessionId>,
  SendMethod<SessionId>,
  RaceCancellation
];

export type AttachSession<SessionId> = (
  sessionId: SessionId,
) => AttachProtocolTransport<SessionId>;

export type DetachSession<SessionId> = (sessionId: SessionId) => void;

export type SendMethod<SessionId> = <
  Method extends string,
  Params extends object,
  Result extends object
>(
  method: Method,
  params?: Params,
  raceCancellation?: RaceCancellation,
) => Promise<Result>;

Readme

Keywords

none

Package Sidebar

Install

npm i @tracerbench/protocol-transport

Weekly Downloads

2,841

Version

2.0.0

License

BSD-2-Clause

Unpacked Size

49.3 kB

Total Files

35

Last publish

Collaborators

  • tsubomi
  • krisselden
  • lynchbomb
  • spham92