func (h *RpcClientHandler) OnMessage(session getty.Session, pkg interface{}) {
	result, ok := pkg.(remoting.DecodeResult)
	if !ok {
		logger.Errorf("illegal package")
		return
	}
	// get heartbeat request from server
	if result.IsRequest {
		req := result.Result.(*remoting.Request)
		if req.Event {
			logger.Debugf("get rpc heartbeat request{%#v}", req)
			resp := remoting.NewResponse(req.ID, req.Version)
			resp.Status = hessian.Response_OK
			resp.Event = req.Event
			resp.SerialID = req.SerialID
			resp.Version = "2.0.2"
			reply(session, resp)
			return
		}
		logger.Errorf("illegal request but not heartbeat. {%#v}", req)
		return
	}
	h.timeoutTimes = 0
	p := result.Result.(*remoting.Response)
	// get heartbeat
	if p.Event {
		logger.Debugf("get rpc heartbeat response{%#v}", p)
		if p.Error != nil {
			logger.Errorf("rpc heartbeat response{error: %#v}", p.Error)
		}
		p.Handle()
		return
	}

	logger.Debugf("get rpc response{%#v}", p)

	h.conn.updateSession(session)

	p.Handle()
}
// OnMessage get response from getty server, and update the session to the getty client session list
OnMessage get response from getty server, and update the session to the getty client session list
// OnMessage get response from getty server and update the session to the getty client session list
func (h *RpcClientHandler) OnMessage(session getty.Session, pkg interface{}) {
	result, ok := pkg.(remoting.DecodeResult)
	if !ok {
		logger.Errorf("illegal package")
		return
	}
	if result.IsRequest {
		req := result.Result.(*remoting.Request)
		if req.Event {
			logger.Debugf("get rpc heartbeat request{%#v}", req)
			resp := remoting.NewResponse(req.ID, req.Version)
			resp.Status = hessian.Response_OK
			resp.Event = req.Event
			resp.SerialID = req.SerialID
			resp.Version = "2.0.2"
			reply(session, resp)
			return
		}
		logger.Errorf("illegal request but not heartbeat. {%#v}", req)
		return
	}
	h.timeoutTimes = 0
	p := result.Result.(*remoting.Response)
	if p.Event {
		logger.Debugf("get rpc heartbeat response{%#v}", p)
		if p.Error != nil {
			logger.Errorf("rpc heartbeat response{error: %#v}", p.Error)
		}
		p.Handle()
		return
	}
	logger.Debugf("get rpc response{%#v}", p)
	h.conn.updateSession(session)
	p.Handle()
}
func ( h * RpcClientHandler ) OnMessage ( session getty . Session , pkg interface { } ) { result , ok := pkg . ( remoting . DecodeResult ) if ! ok { logger . Errorf ( " " ) return } if result . IsRequest { req := result . Result . ( * remoting . Request ) if req . Event { logger . Debugf ( " " , req ) resp := remoting . NewResponse ( req . ID , req . Version ) resp . Status = hessian . Response_OK resp . Event = req . Event resp . SerialID = req . SerialID resp . Version = " " reply ( session , resp ) return } logger . Errorf ( " " , req ) return } h . timeoutTimes = 0 p := result . Result . ( * remoting . Response ) if p . Event { logger . Debugf ( " " , p ) if p . Error != nil { logger . Errorf ( " " , p . Error ) } p . Handle ( ) return } logger . Debugf ( " " , p ) h . conn . updateSession ( session ) p . Handle ( ) }
OnMessage get response from getty server, and update the session to the getty client session list
OnMessage get response from getty server and update the session to the getty client session list
// get heartbeat request from server // get heartbeat