package nnet import "time" var ( DEF_SESSION_ID uint64 = 0 RUBBISH_SESSION_ID uint64 = 1 SESSION_ID_START uint64 = 100 ) type ISession interface { Do() // session SetFrozen(int32) Close(int32) // IsClosed() bool Write(IPacket, time.Duration) error AWrite(IPacket, time.Duration) error // async write GetData() interface{} // user data SetData(interface{}) UpdateId(uint64) // update session id, this will add session pointer into Hub, indexed by its id Id() uint64 // get session id SetId(uint64) ServerAddr() string GetRawConn() IConn } type ISessionCallback interface { OnClosed(ISession, int32) OnConnected(ISession) (bool, int32) OnMessage(ISession, IPacket) bool OnHeartbeat(ISession) bool }