MCPcopy Create free account
hub / github.com/agent-tower/core / closeSocket

Function closeSocket

packages/server/src/socket/index.ts:71–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69 * 关闭 Socket.IO 服务
70 */
71export async function closeSocket(): Promise<void> {
72 if (io) {
73 socketGateway?.destroy()
74 // Kill all active agent session pipelines on shutdown
75 await getSessionManager().destroyAll()
76 // Kill all standalone terminals on shutdown
77 try {
78 const tm = await getTerminalManager()
79 tm.destroyAll()
80 } catch {
81 // TerminalManager may not have been initialized; safe to ignore
82 }
83 await new Promise<void>((resolve) => {
84 io!.close(() => {
85 console.log('[Socket.IO] Closed')
86 resolve()
87 })
88 })
89 socketGateway = null
90 io = null
91 }
92}
93
94// 导出类型和工具
95export * from './events.js'

Callers 1

buildAppFunction · 0.85

Calls 4

getSessionManagerFunction · 0.85
getTerminalManagerFunction · 0.85
destroyMethod · 0.45
destroyAllMethod · 0.45

Tested by

no test coverage detected