Helius
2021-05-26 5575818556096be1dadaf5ff356b5db4c832aaa2
src/main/java/com/xcong/excoin/netty/dispatch/MsgDispatch.java
@@ -19,28 +19,19 @@
 */
@Slf4j
@Component("msgDispatch")
public class MsgDispatch implements ApplicationContextAware {
    private ApplicationContext applicationContext;
public class MsgDispatch {
    @Autowired
    private MsgLogic msgLogic;
    public void webSocketDispatch(ChannelHandlerContext ctx, String msg) {
        log.info("==========={}", msg);
        RequestBean requestBean = null;
        try {
            requestBean = JSONObject.parseObject(msg, RequestBean.class);
            requestBean.setChannelId(ctx.channel().id().asShortText());
            msgLogic.webSocketMsgLogic(requestBean);
        } catch (Exception e) {
            log.info("#websocket json error:{}#", e);
            ctx.channel().writeAndFlush(NettyTools.webSocketBytes("params error"));
        }
    }
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}