MCPcopy Index your code
hub / github.com/SPlayer-Dev/SPlayer / stop

Method stop

electron/main/services/SocketService.ts:157–181  ·  view source on GitHub ↗

* 关闭 WebSocket 服务

()

Source from the content-addressed store, hash-verified

155 * 关闭 WebSocket 服务
156 */
157 public async stop(): Promise<void> {
158 if (!this.wss) return;
159
160 const server = this.wss;
161 socketLog.info("🛑 Stopping WebSocket server...");
162
163 // 关闭所有客户端
164 for (const client of this.clients) {
165 try {
166 client.close();
167 } catch {
168 // ignore
169 }
170 }
171 this.clients.clear();
172
173 await new Promise<void>((resolve) => {
174 server.close(() => {
175 socketLog.info("✅ WebSocket server stopped");
176 resolve();
177 });
178 });
179
180 this.cleanupServer();
181 }
182
183 /**
184 * 处理客户端连接

Callers 1

startMethod · 0.95

Calls 3

cleanupServerMethod · 0.95
closeMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected