You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
583 B

  1. package zrouter
  2. import (
  3. "github.com/aceld/zinx/ziface"
  4. "github.com/aceld/zinx/zlog"
  5. "github.com/aceld/zinx/znet"
  6. )
  7. //ping test 自定义路由
  8. type PingRouter struct {
  9. znet.BaseRouter
  10. }
  11. //Ping Handle
  12. func (this *PingRouter) Handle(request ziface.IRequest) {
  13. zlog.Debug("Call PingRouter Handle")
  14. //先读取客户端的数据,再回写ping...ping...ping
  15. zlog.Debug("recv from client : msgId=", request.GetMsgID(), ", data=", string(request.GetData()))
  16. err := request.GetConnection().SendBuffMsg(0, []byte("ping...ping...ping"))
  17. if err != nil {
  18. zlog.Error(err)
  19. }
  20. }