import { Socket } from 'socket.io' ; import { EventTypes } from './events.types' ; export abstract class BaseGateway { public gatewayMessageFormat ( type , message ) { return { type , data : message , } ; } handleDisconnect ( client ) { client . send ( this . gatewayMessageFormat ( EventTypes . GATEWAY_CONNECT , 'WebSocket 断开' ) ) ; } handleConnect ( client ) { client . send ( this . gatewayMessageFormat ( EventTypes . GATEWAY_CONNECT , 'WebSocket 已连接' ) ) ; } }