SessionListener添加Session注册事件
parent
c869bd2280
commit
166d9971a1
|
@ -72,6 +72,8 @@ public class Session {
|
|||
this.clientId = message.getClientId();
|
||||
if (sessionManager != null)
|
||||
sessionManager.add(this);
|
||||
if (sessionListener != null)
|
||||
sessionListener.sessionRegistered(this);
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
|
|
|
@ -5,9 +5,16 @@ package io.github.yezhihao.netmc.session;
|
|||
* home https://gitee.com/yezhihao/jt808-server
|
||||
*/
|
||||
public interface SessionListener {
|
||||
|
||||
/** 客户端建立连接 */
|
||||
default void sessionCreated(Session session) {
|
||||
}
|
||||
|
||||
/** 客户端完成注册或鉴权 */
|
||||
default void sessionRegistered(Session session) {
|
||||
}
|
||||
|
||||
/** 客户端注销或离线 */
|
||||
default void sessionDestroyed(Session session) {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue