A client side Comm interface.

interface IComm {
    commId: string;
    commsOverSubshells?: CommsOverSubshells;
    isDisposed: boolean;
    onClose: (
        msg: ICommCloseMsg<"iopub" | "shell">,
    ) => void | PromiseLike<void>;
    onMsg: (msg: ICommMsgMsg<"iopub" | "shell">) => void | PromiseLike<void>;
    targetName: string;
    close(
        data?: JSONValue,
        metadata?: JSONObject,
        buffers?: (ArrayBuffer | ArrayBufferView)[],
    ): IShellFuture<
        IShellMessage<ShellMessageType>,
        IShellMessage<ShellMessageType>,
    >;
    dispose(): void;
    open(
        data?: JSONValue,
        metadata?: JSONObject,
        buffers?: (ArrayBuffer | ArrayBufferView)[],
    ): IShellFuture<
        IShellMessage<ShellMessageType>,
        IShellMessage<ShellMessageType>,
    >;
    send(
        data: JSONValue,
        metadata?: JSONObject,
        buffers?: (ArrayBuffer | ArrayBufferView)[],
        disposeOnDone?: boolean,
    ): IShellFuture<
        IShellMessage<ShellMessageType>,
        IShellMessage<ShellMessageType>,
    >;
}

Hierarchy

Properties

commId: string

The unique id for the comm channel.

commsOverSubshells?: CommsOverSubshells

Whether comms are running on subshell or not.

isDisposed: boolean

Test whether the object has been disposed.

This property is always safe to access.

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

Callback for a comm close event.

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.

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

Callback for a comm message received event.

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

targetName: string

The target name for the comm channel.

Methods

  • Dispose of the resources held by the object.

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

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

    Returns void