WebSocketHandler.ts 423 B

1234567891011121314151617
  1. import { WebSocket as WS } from 'ws';
  2. abstract class WebSocketHandler {
  3. public static Event = {
  4. CONNECTION: 'connection',
  5. MESSAGE: 'message',
  6. CLOSE: 'close',
  7. ERROR: 'error'
  8. };
  9. public abstract onConnect: (ws: WS) => any;
  10. public abstract onMessage: (message: string) => any;
  11. public abstract onError: () => any;
  12. public abstract onClose: (code?: number, reason?: string) => any;
  13. }
  14. export { WebSocketHandler };