(handler: unknown)
| 2744 | } |
| 2745 | |
| 2746 | function resolveHandler(handler: unknown): WsHandler { |
| 2747 | if (typeof handler === "function") { |
| 2748 | return handler as WsHandler; |
| 2749 | } |
| 2750 | |
| 2751 | if ( |
| 2752 | typeof handler === "object" && |
| 2753 | handler !== null && |
| 2754 | "onmessage" in handler && |
| 2755 | typeof handler.onmessage === "function" |
| 2756 | ) { |
| 2757 | return handler.onmessage as WsHandler; |
| 2758 | } |
| 2759 | |
| 2760 | throw new Error("Invalid websocket message handler."); |
| 2761 | } |
| 2762 | |
| 2763 | function sendWsText(handler: WsHandler, payload: unknown[]) { |
| 2764 | handler({ |
no outgoing calls
no test coverage detected