logics.go 669 B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import "git.wanbits.io/joe/nnet"
  3. // protocol && callback, Using TCP
  4. type ALProtocol struct{}
  5. func (self *ALProtocol) ReadPacket(conn nnet.IConn) (nnet.IPacket, error) {
  6. return nil, nil
  7. }
  8. func (self *ALProtocol) Serialize(packet nnet.IPacket) ([]byte, error) {
  9. return nil, nil
  10. }
  11. func (self *ALProtocol) OnClosed(ses nnet.ISession, reason int32) {
  12. }
  13. func (self *ALProtocol) OnConnected(ses nnet.ISession) (bool, int32) {
  14. return true, 0
  15. }
  16. func (self *ALProtocol) OnMessage(ses nnet.ISession, pkt nnet.IPacket) bool {
  17. return true
  18. }
  19. // server-side dont handle heartbeat.
  20. func (self *ALProtocol) OnHeartbeat(ses nnet.ISession) bool {
  21. return true
  22. }