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) => 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.

Type declaration

onMsg

onMsg: (msg: ICommMsgMsg) => 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.

Type declaration

Readonly targetName

targetName: string

The target name for the comm channel.

Methods

close

  • close(data?: JSONValue, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[]): IShellFuture
  • Close the comm.

    Parameters

    • Optional data: JSONValue

      The data to send to the server on opening.

    • Optional metadata: JSONObject

      Additional metatada for the message.

    • Optional buffers: (ArrayBuffer | ArrayBufferView)[]

    Returns IShellFuture

    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(data?: JSONValue, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[]): IShellFuture
  • 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 metatada for the message.

    • Optional buffers: (ArrayBuffer | ArrayBufferView)[]

    Returns IShellFuture

    A future for the generated message.

    Notes

    This sends a comm_open message to the server.

send

  • send(data: JSONValue, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[], disposeOnDone?: boolean): IShellFuture
  • Send a comm_msg message to the kernel.

    Parameters

    • data: JSONValue

      The data to send to the server on opening.

    • Optional metadata: JSONObject

      Additional metatada for the message.

    • Optional buffers: (ArrayBuffer | ArrayBufferView)[]

      Optional buffer data.

    • Optional disposeOnDone: boolean

      Whether to dispose of the future when done.

    Returns IShellFuture

    A future for the generated message.

    Notes

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

Generated using TypeDoc