ing
This commit is contained in:
		
							parent
							
								
									9d3486ca28
								
							
						
					
					
						commit
						4d5dea3f21
					
				@ -55,21 +55,7 @@ type ServerHandlers struct {
 | 
			
		||||
	socketHandlers map[string]SocketHandler
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) Listen() (net.Listener, error) {
 | 
			
		||||
	return nil, errors.New("Server: Handler method[Listen] of Server is not implement")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) CheckOrigin(ctx *fasthttp.RequestCtx) bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) OnError(ctx *fasthttp.RequestCtx, status int, reason error) {
 | 
			
		||||
	logging.Logger().Error(fmt.Sprintf("Server: error status: %d, reason: %v, [%v]", status, reason, ctx))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OnStart invoked when server is stated
 | 
			
		||||
// If you override ths method, must call
 | 
			
		||||
func (sh *ServerHandlers) OnStart() error {
 | 
			
		||||
func (sh *ServerHandlers) Init() error {
 | 
			
		||||
	if nil != sh.socketHandlers {
 | 
			
		||||
		for _, socketHandler := range sh.socketHandlers {
 | 
			
		||||
			if err := socketHandler.Init(); nil != err {
 | 
			
		||||
@ -81,6 +67,24 @@ func (sh *ServerHandlers) OnStart() error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) Listen() (net.Listener, error) {
 | 
			
		||||
	return nil, errors.New("Server: Handler method[Listen] of Server is not implement")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OnStart invoked when server is stated
 | 
			
		||||
// If you override ths method, must call
 | 
			
		||||
func (sh *ServerHandlers) OnStart() {
 | 
			
		||||
	// no op
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) CheckOrigin(ctx *fasthttp.RequestCtx) bool {
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sh *ServerHandlers) OnError(ctx *fasthttp.RequestCtx, status int, reason error) {
 | 
			
		||||
	logging.Logger().Error(fmt.Sprintf("Server: error status: %d, reason: %v, [%v]", status, reason, ctx))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OnStop invoked when server is stopped
 | 
			
		||||
// If you override ths method, must call
 | 
			
		||||
func (sh *ServerHandlers) OnStop() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user