Class: ActuallyColabSocketClient#

Hierarchy#

  • EventEmitter<ActuallyColabEventListeners>

    ↳ ActuallyColabSocketClient

Constructors#

constructor#

+ new ActuallyColabSocketClient(baseURL: string, sessionToken: string): ActuallyColabSocketClient

Establishes a new client connection to the Actually Colab server.

Parameters:#

NameTypeDescription
baseURLstringActually Colab API basename
sessionTokenstringauthorization token for Actually Colab

Returns: ActuallyColabSocketClient

Overrides: void

Defined in: src/socket/client.ts:108

Properties#

editCell#

• editCell: MemoizeDebouncedFunction<(nb\_id: string, cell\_id: string, cellData: Required<Pick<DCell, language | contents | cursor_col | cursor_row>>) => void>

Edits the contents of a cell.

Will fail if cell lock not acquired.

param Notebook to create cell in

param Cell to edit

param Cell data to replace with

Defined in: src/socket/client.ts:414


socketClient#

• Private socketClient: w3cwebsocket

Defined in: src/socket/client.ts:108


updateOutput#

• updateOutput: MemoizeDebouncedFunction<(nb\_id: string, cell\_id: string, output: string) => void>

Sends a compressed output for a cell to be shared with users in the notebook.

param Notebook to update

param Cell to update

param Content to share

Defined in: src/socket/client.ts:447


prefixed#

â–ª Static prefixed: string | boolean

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:9

Methods#

addListener#

â–¸ addListener<T>(event: T, fn: (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void, context?: any): ActuallyColabSocketClient

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT
fn(...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void
context?any

Returns: ActuallyColabSocketClient

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:45


close#

â–¸ close(): void

Disconnects from server, but does not remove event listeners.

Returns: void

Defined in: src/socket/client.ts:276


closeNotebook#

â–¸ closeNotebook(nb_id: string): void

Closes a connection to a specific notbeook.

Parameters:#

NameTypeDescription
nb_idstringNotebook to disconnect from

Returns: void

Defined in: src/socket/client.ts:309


createCell#

â–¸ createCell(nb_id: string, language: python | markdown): void

Creates a new cell in a notebook.

Parameters:#

NameTypeDescription
nb_idstringNotebook to create cell in.
languagepython | markdownProgramming language of cell.

Returns: void

Defined in: src/socket/client.ts:375


deleteCell#

â–¸ deleteCell(nb_id: string, cell_id: string): void

Deletes a specific cell from a specific notebook

Parameters:#

NameTypeDescription
nb_idstringNotebook containing the cell
cell_idstringCell to delete

Returns: void

Defined in: src/socket/client.ts:436


disconnectAndRemoveAllListeners#

â–¸ disconnectAndRemoveAllListeners(): void

Aborts all in-flight requests, removes all event listeners, and closes the connection to the Actually Colab Socket API.

Returns: void

Defined in: src/socket/client.ts:284


emit#

â–¸ emit<T>(event: T, ...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]): boolean

Calls each of the listeners registered for a given event.

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT
...argsArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]

Returns: boolean

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:32


eventNames#

â–¸ eventNames(): (keyof SocketConnectionListeners | keyof SocketMessageListeners)[]

Return an array listing the events for which the emitter has registered listeners.

Returns: (keyof SocketConnectionListeners | keyof SocketMessageListeners)[]

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:15


initSocketEventListeners#

â–¸ PrivateinitSocketEventListeners(): void

Returns: void

Defined in: src/socket/client.ts:124


listenerCount#

â–¸ listenerCount(event: keyof SocketConnectionListeners | keyof SocketMessageListeners): number

Return the number of listeners listening to a given event.

Parameters:#

NameType
eventkeyof SocketConnectionListeners | keyof SocketMessageListeners

Returns: number

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:27


listeners#

â–¸ listeners<T>(event: T): (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void[]

Return the listeners registered for a given event.

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT

Returns: (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void[]

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:20


lockCell#

â–¸ lockCell(nb_id: string, cell_id: string): void

Acquires a cell lock for editing.

Parameters:#

NameTypeDescription
nb_idstringNotebook to create cell in.
cell_idstringCell to edit.

Returns: void

Defined in: src/socket/client.ts:385


off#

â–¸ off<T>(event: T, fn?: (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void, context?: any, once?: boolean): ActuallyColabSocketClient

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT
fn?(...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void
context?any
once?boolean

Returns: ActuallyColabSocketClient

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:69


on#

â–¸ on<T>(event: T, fn: (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void, context?: any): ActuallyColabSocketClient

Add a listener for a given event.

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT
fn(...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void
context?any

Returns: ActuallyColabSocketClient

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:40


once#

â–¸ once<T>(event: T, fn: (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void, context?: any): ActuallyColabSocketClient

Add a one-time listener for a given event.

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT
fn(...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void
context?any

Returns: ActuallyColabSocketClient

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:54


openNotebook#

â–¸ openNotebook(nb_id: string): void

Connects to a specific notebook.

Parameters:#

NameTypeDescription
nb_idstringNotebook to connect to.

Returns: void

Defined in: src/socket/client.ts:300


removeAllListeners#

â–¸ removeAllListeners(event?: keyof SocketConnectionListeners | keyof SocketMessageListeners): ActuallyColabSocketClient

Remove all listeners, or those of the specified event.

Parameters:#

NameType
event?keyof SocketConnectionListeners | keyof SocketMessageListeners

Returns: ActuallyColabSocketClient

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:79


removeListener#

â–¸ removeListener<T>(event: T, fn?: (...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void, context?: any, once?: boolean): ActuallyColabSocketClient

Remove the listeners of a given event.

Type parameters:#

NameType
Tkeyof SocketConnectionListeners | keyof SocketMessageListeners

Parameters:#

NameType
eventT
fn?(...args: ArgumentMap<ActuallyColabEventListeners>[Extract<T, keyof SocketConnectionListeners | keyof SocketMessageListeners>]) => void
context?any
once?boolean

Returns: ActuallyColabSocketClient

Inherited from: void

Defined in: node_modules/eventemitter3/index.d.ts:63


sendChatMessage#

â–¸ sendChatMessage(nb_id: string, message: string): void

Echoes a message into the notebook chat.

Parameters:#

NameTypeDescription
nb_idstringThe notebook to broadcast to
messagestringText to send

Returns: void

Defined in: src/socket/client.ts:477


sendEvent#

â–¸ PrivatesendEvent(action: string, data: Record<string, unknown>): void

Parameters:#

NameType
actionstring
dataRecord<string, unknown>

Returns: void

Defined in: src/socket/client.ts:290


shareNotebook#

â–¸ shareNotebook(emails: string[], nb_id: undefined | null | string | number | boolean, access_level: NotebookAccessLevelType): void

Shares a notebook with another user. The requesting user must have Full Access to share the notebook.

Parameters:#

NameTypeDescription
emailsstring[]-
nb_idundefined | null | string | number | booleanid of the notebook to share
access_levelNotebookAccessLevelTypepermissions level for the user that the notebook is being shared with

Returns: void

Defined in: src/socket/client.ts:321


shareWorkshop#

â–¸ shareWorkshop(emails: string[], ws_id: undefined | null | string | number | boolean, access_level: WorkshopAccessLevelType): void

Shares a workshop with another user. The requesting user must have Instructor access to share the notebook.

Parameters:#

NameTypeDescription
emailsstring[]users to share with
ws_idundefined | null | string | number | booleanid of the workshop to share
access_levelWorkshopAccessLevelTypepermissions level for the user that the workshop is being shared with

Returns: void

Defined in: src/socket/client.ts:351


startWorkshop#

â–¸ startWorkshop(ws_id: undefined | null | string | number | boolean): void

Starts a new workshop. The requesting user must have Instructor access.

Parameters:#

NameTypeDescription
ws_idundefined | null | string | number | booleanid of the workshop to share

Returns: void

Defined in: src/socket/client.ts:365


unlockCell#

â–¸ unlockCell(nb_id: string, cell_id: string, cellData: Required<Pick<DCell, language | contents | cursor_col | cursor_row>>): void

Releases a cell lock. Must have acquired lock.

Parameters:#

NameTypeDescription
nb_idstringNotebook to create cell in.
cell_idstringCell to edit.
cellDataRequired<Pick<DCell, language | contents | cursor_col | cursor_row>>Cell data to replace with

Returns: void

Defined in: src/socket/client.ts:396


unshareNotebook#

â–¸ unshareNotebook(emails: string[], nb_id: undefined | null | string | number | boolean): void

Revokes notebook access from another user. The requesting user must have Full Access to share the notebook.

Parameters:#

NameTypeDescription
emailsstring[]users to revoke access from
nb_idundefined | null | string | number | booleanid of the notebook

Returns: void

Defined in: src/socket/client.ts:336