Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommHandler

Comm channel handler.

Hierarchy

  • DisposableDelegate
    • CommHandler

Implements

Index

Constructors

constructor

  • new CommHandler(target: string, id: string, kernel: IKernel, disposeCb: function): CommHandler
  • Construct a new comm channel.

    Parameters

    • target: string
    • id: string
    • kernel: IKernel
    • disposeCb: function
        • (): void
        • Returns void

    Returns CommHandler

Properties

Private _id

_id: string = ""

Private _kernel

_kernel: IKernel

Private _onClose

_onClose: function

Type declaration

Private _onMsg

_onMsg: function

Type declaration

Private _target

_target: string = ""

isDisposed

isDisposed: boolean

Test whether the delegate has been disposed.

Accessors

commId

  • get commId(): string

onClose

  • get onClose(): function
  • set onClose(cb: function): void
  • Get the callback for a comm close event.

    Notes

    This is called when the comm is closed from either the server or client.

    See also: [[ICommClose]], close

    Returns function

  • Set the callback for a comm close event.

    Notes

    This is called when the comm is closed from either the server or client. If the function returns a promise, and the kernel was closed from the server, kernel message processing will pause until the returned promise is fulfilled.

    See also: close

    Parameters

    Returns void

onMsg

  • get onMsg(): function
  • set onMsg(cb: function): void
  • Get the callback for a comm message received event.

    Notes

    This is called when a comm message is received. If the function returns a promise, kernel message processing will pause until it is fulfilled.

    Returns function

  • Set the callback for a comm message received event.

    Notes

    This is called when a comm message is received. If the function returns a promise, kernel message processing will pause until it is fulfilled.

    Parameters

    • cb: function

    Returns void

targetName

  • get targetName(): string

Methods

close

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

    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.

    See also: [[ICommClose]], onClose

    Parameters

    • Optional data: JSONObject
    • Optional metadata: JSONObject
    • Default value buffers: (ArrayBuffer | ArrayBufferView)[] = []

    Returns IShellFuture

dispose

  • dispose(): void
  • Dispose of the delegate and invoke the callback function.

    Returns void

open

  • open(data?: JSONObject, metadata?: JSONObject, buffers?: (ArrayBuffer | ArrayBufferView)[]): IShellFuture
  • Open a comm with optional data and metadata.

    Notes

    This sends a comm_open message to the server.

    See also: [[ICommOpen]]

    Parameters

    • Optional data: JSONObject
    • Optional metadata: JSONObject
    • Default value buffers: (ArrayBuffer | ArrayBufferView)[] = []

    Returns IShellFuture

send

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

    Notes

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

    See also: [[ICommMsg]]

    Parameters

    • data: JSONObject
    • Optional metadata: JSONObject
    • Default value buffers: (ArrayBuffer | ArrayBufferView)[] = []
    • Default value disposeOnDone: boolean = true

    Returns IShellFuture

Generated using TypeDoc