MCPcopy Index your code
hub / github.com/coder/coder / watchWorkspaceAgentLogs

Function watchWorkspaceAgentLogs

site/src/api/api.ts:294–316  ·  view source on GitHub ↗
(
	agentId: string,
	params?: WatchWorkspaceAgentLogsParams,
)

Source from the content-addressed store, hash-verified

292};
293
294export const watchWorkspaceAgentLogs = (
295 agentId: string,
296 params?: WatchWorkspaceAgentLogsParams,
297) => {
298 const searchParams = new URLSearchParams({
299 follow: "true",
300 after: params?.after?.toString() ?? "",
301 });
302
303 /**
304 * WebSocket compression in Safari (confirmed in 16.5) is broken when
305 * the server sends large messages. The following error is seen:
306 * WebSocket connection to 'wss://...' failed: The operation couldn't be completed.
307 */
308 if (userAgentParser(navigator.userAgent).browser.name === "Safari") {
309 searchParams.set("no_compression", "");
310 }
311
312 return new OneWayWebSocket<TypesGen.WorkspaceAgentLog[]>({
313 apiRoute: `/api/v2/workspaceagents/${agentId}/logs`,
314 searchParams,
315 });
316};
317
318type WatchWorkspaceAgentLogsParams = {
319 after?: number;

Callers 1

useAgentLogsFunction · 0.90

Calls 1

setMethod · 0.45

Tested by

no test coverage detected