Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IComm

A client side Comm interface.

Hierarchy

  • IDisposable
    • IComm

Index

Properties

Readonly commId

commId: string

The unique id for the comm channel.

Readonly isDisposed

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

onClose

onClose: (msg: ICommCloseMsg<"iopub" | "shell">) => void | PromiseLike<void>

Type declaration

    • (msg: ICommCloseMsg<"iopub" | "shell">): void | PromiseLike<void>
    • Callback for a comm close event.

      Notes

      This is called when the comm is closed from either the server or client. If this is called in response to a kernel message and the handler returns a promise, all kernel message processing pauses until the promise is resolved.

      Parameters

      Returns void | PromiseLike<void>

onMsg

onMsg: (msg: ICommMsgMsg<"iopub" | "shell">) => void | PromiseLike<void>

Type declaration

    • (msg: ICommMsgMsg<"iopub" | "shell">): void | PromiseLike<void>
    • Callback for a comm message received event.

      Notes

      If the handler returns a promise, all kernel message processing pauses until the promise is resolved.

      Parameters

      Returns void | PromiseLike<void>

Readonly targetName

targetName: string

The target name for the comm channel.

Methods

close

  • Close the comm.

    Parameters

    • Optional data: JSONValue

      The data to send to the server on opening.

    • Optional metadata: JSONObject

      Additional metadata for the message.

    • Optional buffers: (ArrayBuffer | ArrayBufferView)[]

    Returns IShellFuture<IShellMessage<ShellMessageType>, IShellMessage<ShellMessageType>>

    A future for the generated message.

    Notes

    This will send a comm_close message to the kernel, and call the onClose callback if set.

    This is a no-op if the comm is already closed.

dispose

  • dispose(): void
  • Dispose of the resources held by the object.

    Notes

    If the object's dispose method is called more than once, all calls made after the first will be a no-op.

    Undefined Behavior

    It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

    Returns void

open

  • Open a comm with optional data and metadata.

    Parameters

    • Optional data: JSONValue

      The data to send to the server on opening.

    • Optional metadata: JSONObject

      Additional metadata for the message.

    • Optional buffers: (ArrayBuffer | ArrayBufferView)[]

    Returns IShellFuture<IShellMessage<ShellMessageType>, IShellMessage<ShellMessageType>>

    A future for the generated message.

    Notes

    This sends a comm_open message to the server.

send

  • Send a comm_msg message to the kernel.

    Parameters

    • data: JSONValue

      The data to send to the server on opening.

    • Optional metadata: JSONObject

      Additional metadata for the message.

    • Optional buffers: (ArrayBuffer | ArrayBufferView)[]

      Optional buffer data.

    • Optional disposeOnDone: boolean

      Whether to dispose of the future when done.

    Returns IShellFuture<IShellMessage<ShellMessageType>, IShellMessage<ShellMessageType>>

    A future for the generated message.

    Notes

    This is a no-op if the comm has been closed.

Generated using TypeDoc