Interface of a session object.

A session object represents a live connection to a session kernel.

This represents a persistent kernel connection with a particular key, that persists across changing kernels and kernels getting terminated. As such, a number of signals are proxied from the current kernel for convenience.

The kernel is owned by the session, in that the session creates the kernel and manages its lifecycle.

interface ISessionConnection {
    anyMessage: ISignal<ISessionConnection, IAnyMessageArgs>;
    connectionStatusChanged: ISignal<ISessionConnection, Kernel.ConnectionStatus>;
    disposed: ISignal<ISessionConnection, void>;
    id: string;
    iopubMessage: ISignal<ISessionConnection, IIOPubMessage<IOPubMessageType>>;
    isDisposed: boolean;
    kernel: null | IKernelConnection;
    kernelChanged: ISignal<ISessionConnection, IChangedArgs<null | IKernelConnection, null | IKernelConnection, "kernel">>;
    model: Session.IModel;
    name: string;
    path: string;
    pendingInput: ISignal<ISessionConnection, boolean>;
    propertyChanged: ISignal<ISessionConnection, "type" | "name" | "path">;
    serverSettings: ServerConnection.ISettings;
    statusChanged: ISignal<ISessionConnection, Status>;
    type: string;
    unhandledMessage: ISignal<ISessionConnection, KernelMessage.IMessage<KernelMessage.MessageType>>;
    changeKernel(options): Promise<null | IKernelConnection>;
    dispose(): void;
    setName(name): Promise<void>;
    setPath(path): Promise<void>;
    setType(type): Promise<void>;
    shutdown(): Promise<void>;
}

Hierarchy

Properties

The kernel anyMessage signal, proxied from the current kernel.

The kernel connectionStatusChanged signal, proxied from the current kernel.

disposed: ISignal<ISessionConnection, void>

A signal emitted when the object is disposed.

id: string

Unique id of the session.

The kernel iopubMessage signal, proxied from the current kernel.

isDisposed: boolean

Test whether the object has been disposed.

Notes

This property is always safe to access.

kernel: null | IKernelConnection

The kernel.

Notes

This is a read-only property, and can be altered by [changeKernel].

A number of kernel signals are proxied through the session from whatever the current kernel is for convenience.

A signal emitted when the kernel changes.

The model associated with the session.

name: string

The current name associated with the session.

path: string

The current path associated with the session.

pendingInput: ISignal<ISessionConnection, boolean>

The kernel pendingInput signal, proxied from the current kernel.

propertyChanged: ISignal<ISessionConnection, "type" | "name" | "path">

A signal emitted when a session property changes.

serverSettings: ServerConnection.ISettings

The server settings of the session.

The kernel statusChanged signal, proxied from the current kernel.

type: string

The type of the session.

The kernel unhandledMessage signal, proxied from the current kernel.

Methods

  • 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

  • Change the session name.

    Parameters

    • name: string

    Returns Promise<void>

    A promise that resolves when the session has renamed.

    Notes

    This uses the Jupyter REST API, and the response is validated. The promise is fulfilled on a valid response and rejected otherwise.

  • Change the session path.

    Parameters

    • path: string

      The new session path.

    Returns Promise<void>

    A promise that resolves when the session has renamed.

    Notes

    This uses the Jupyter REST API, and the response is validated. The promise is fulfilled on a valid response and rejected otherwise.

  • Change the session type.

    Parameters

    • type: string

    Returns Promise<void>

    A promise that resolves when the session has renamed.

    Notes

    This uses the Jupyter REST API, and the response is validated. The promise is fulfilled on a valid response and rejected otherwise.

  • Kill the kernel and shutdown the session.

    Returns Promise<void>

    A promise that resolves when the session is shut down.

    Notes

    This uses the Jupyter REST API, and the response is validated. The promise is fulfilled on a valid response and rejected otherwise.