(list: T[], item: T)
| 6 | |
| 7 | type WebSocketCallback = (socket: WebSocket, request: IncomingMessage, ctx: KoaContext) => void; |
| 8 | function remove<T>(list: T[], item: T) { |
| 9 | const index = list.indexOf(item); |
| 10 | if (index >= 0) list.splice(index, 1); |
| 11 | } |
| 12 | |
| 13 | export class WebSocketLayer { |
| 14 | clients = new Set<WebSocket>(); |