Skip to content

Commit

Permalink
nats terminal: implement 'kick'
Browse files Browse the repository at this point in the history
  • Loading branch information
williamstein committed Feb 16, 2025
1 parent 7b215d6 commit 16b8e0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
});
this.conn = conn as any;
conn.on("close", this.connect);
conn.on("kick", this.close_request);
conn.on("data", this._handle_data_from_project);
conn.once("ready", () => {
delete this.last_geom;
Expand Down Expand Up @@ -682,7 +683,7 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
await callback(g);
}

close_request(): void {
close_request = (): void => {
this.actions.set_error("You were removed from a terminal.");
// If there is only one frame, we close the
// entire editor -- otherwise, we close only
Expand All @@ -695,7 +696,7 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
} else {
this.actions.close_frame(this.id);
}
}
};

private use_subframe(path: string): boolean {
const this_path_ext = filename_extension(this.actions.path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ export class NatsTerminalConnection extends EventEmitter {
},

kick: async (sender_browser_id) => {
console.log(
`everyone but ${sender_browser_id} must go!`,
webapp_client.browser_id,
);
if (sender_browser_id == webapp_client.browser_id) {
// I sent the kick
return;
}
this.emit("kick");
},

size: async ({ rows, cols }) => {
Expand Down

0 comments on commit 16b8e0e

Please sign in to comment.