MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / attachById

Method attachById

src/workspaces/session-pool.ts:127–138  ·  view source on GitHub ↗

Attach a WebSocket to a known record. Returns false if id is unknown.

(
    recordId: string,
    ws: WebSocket,
    cols: number,
    rows: number,
    since: number | undefined,
    claim?: SessionControllerClaim,
  )

Source from the content-addressed store, hash-verified

125
126 /** Attach a WebSocket to a known record. Returns false if id is unknown. */
127 attachById(
128 recordId: string,
129 ws: WebSocket,
130 cols: number,
131 rows: number,
132 since: number | undefined,
133 claim?: SessionControllerClaim,
134 ): SessionAttachResult | { readonly ok: false; readonly reason: 'missing' } {
135 const session = this.sessions.get(recordId);
136 if (!session) return { ok: false, reason: 'missing' };
137 return session.attach(ws, cols, rows, since, claim);
138 }
139
140 get(recordId: string): PersistentSession | undefined {
141 return this.sessions.get(recordId);

Callers 2

onMessageFunction · 0.80
attachWorkspacesWSFunction · 0.80

Calls 2

attachMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected