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:#
| Name | Type | Description |
|---|---|---|
baseURL | string | Actually Colab API basename |
sessionToken | string | authorization 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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | Notebook 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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | Notebook to create cell in. |
language | python | markdown | Programming 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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | Notebook containing the cell |
cell_id | string | Cell 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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
...args | ArgumentMap<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:#
| Name | Type |
|---|---|
event | keyof 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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | Notebook to create cell in. |
cell_id | string | Cell 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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | Notebook 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:#
| Name | Type |
|---|---|
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:#
| Name | Type |
|---|---|
T | keyof SocketConnectionListeners | keyof SocketMessageListeners |
Parameters:#
| Name | Type |
|---|---|
event | T |
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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | The notebook to broadcast to |
message | string | Text to send |
Returns: void
Defined in: src/socket/client.ts:477
sendEvent#
â–¸ PrivatesendEvent(action: string, data: Record<string, unknown>): void
Parameters:#
| Name | Type |
|---|---|
action | string |
data | Record<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:#
| Name | Type | Description |
|---|---|---|
emails | string[] | - |
nb_id | undefined | null | string | number | boolean | id of the notebook to share |
access_level | NotebookAccessLevelType | permissions 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:#
| Name | Type | Description |
|---|---|---|
emails | string[] | users to share with |
ws_id | undefined | null | string | number | boolean | id of the workshop to share |
access_level | WorkshopAccessLevelType | permissions 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:#
| Name | Type | Description |
|---|---|---|
ws_id | undefined | null | string | number | boolean | id 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:#
| Name | Type | Description |
|---|---|---|
nb_id | string | Notebook to create cell in. |
cell_id | string | Cell to edit. |
cellData | Required<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:#
| Name | Type | Description |
|---|---|---|
emails | string[] | users to revoke access from |
nb_id | undefined | null | string | number | boolean | id of the notebook |
Returns: void
Defined in: src/socket/client.ts:336