Skip to content

Commit

Permalink
调整 ToHandlerListener 基类改为 EventListener(更方便定制)
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed Jan 27, 2024
1 parent 4782d16 commit 9d49983
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions UPDATE_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
* 调整 取消启动参数简写模式,保持与应用参数相同的名字 ???
* 新增 graphql-solon-plugin 插件

### 2.7.0
* 把 mvc 能力独立为 solon.mvc
* 添加 @AddMethod 注解(at class),实现 @Get, @Options 限定本意

### 2.6.6
* 添加 ToSocketdWebSocketListener::setListener 接口,强第复用性
* 添加 ToHandlerListener 对异常反馈的支持
Expand All @@ -31,6 +35,7 @@
* 添加 smarthttp 适配对 websocket header 的处理
* 调整 enableMd5key 返回(支持链式返回自己)
* 调整 路由拦截器匹配规则采用pathNew方法(原为path)
* 调整 ToHandlerListener 基类改为 EventListener(更方便定制)
* 修复 WebSocket 不能获取 queryString 单字母参数问题
* liteflow 升为 2.11.4.2
* snack3 升为 3.2.88
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.noear.socketd.transport.core.Message;
import org.noear.socketd.transport.core.Session;
import org.noear.socketd.transport.core.listener.SimpleListener;
import org.noear.socketd.transport.core.listener.EventListener;
import org.noear.solon.Solon;
import org.noear.solon.Utils;
import org.slf4j.Logger;
Expand All @@ -16,11 +16,15 @@
* @author noear
* @since 2.0
*/
public class ToHandlerListener extends SimpleListener {
public class ToHandlerListener extends EventListener {
private static final Logger log = LoggerFactory.getLogger(ToHandlerListener.class);

@Override
public void onMessage(Session session, Message message) throws IOException {
public ToHandlerListener() {
super();
doOnMessage(this::onMessageDo);
}

protected void onMessageDo(Session session, Message message) throws IOException {
if (Utils.isEmpty(message.event())) {
log.warn("This message is missing route, sid={}", message.sid());
return;
Expand Down

0 comments on commit 9d49983

Please sign in to comment.