Function
removeWebSocketHandler
(this: AppiumServer, handlerPathname: string)
Source from the content-addressed store, hash-verified
| 34 | * @see AppiumServerExtension.removeWebSocketHandler |
| 35 | */ |
| 36 | export 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
Tested by
no test coverage detected