MCPcopy Create free account
hub / github.com/appium/appium / removeWebSocketHandler

Function removeWebSocketHandler

packages/http-server/lib/websocket.ts:36–54  ·  view source on GitHub ↗
(this: AppiumServer, handlerPathname: string)

Source from the content-addressed store, hash-verified

34 * @see AppiumServerExtension.removeWebSocketHandler
35 */
36export async function removeWebSocketHandler(this: AppiumServer, handlerPathname: string): Promise<boolean> {
37 const wsServer = this.webSocketsMapping?.[handlerPathname];
38 if (!wsServer) {
39 return false;
40 }
41
42 try {
43 wsServer.close();
44 for (const client of wsServer.clients || []) {
45 client.terminate();
46 }
47 return true;
48 } catch {
49 // ignore
50 } finally {
51 delete this.webSocketsMapping[handlerPathname];
52 }
53 return false;
54}
55
56/**
57 * Removes all WebSocket handlers from this server.

Callers

nothing calls this directly

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected