package servlet import ( "git.loafle.net/commons_go/logging" cwf "git.loafle.net/commons_go/websocket_fasthttp" ) type ServletHandlers struct { cwf.SocketHandlers // EntryPath is path of url (ex: /web) EntryPath string } func (sh *ServletHandlers) Init() error { if err := sh.SocketHandlers.Init(); nil != err { return err } return nil } // OnConnect invoked when client is connected // If you override ths method, must call func (sh *ServletHandlers) OnConnect(soc *cwf.Socket) { sh.SocketHandlers.OnConnect(soc) } // OnDisconnect invoked when client is disconnected // If you override ths method, must call func (sh *ServletHandlers) OnDisconnect(soc *cwf.Socket) { sh.SocketHandlers.OnDisconnect(soc) } // Destroy invoked when server is stopped // If you override ths method, must call func (sh *ServletHandlers) Destroy() { sh.SocketHandlers.Destroy() } func (sh *ServletHandlers) Validate() { sh.SocketHandlers.Validate() if "" == sh.EntryPath { logging.Logger().Panic("Geteway Server: The path of entry must be specified") } }