netty(二十二)WebSocket与http共用端口

接 netty(六)WebSocket实践

 

netty(六)WebSocket实践中第2点,有对运行期修改pipeline的思路

我们借用之,使之在本例中使用,运行期判断是否是websocket,如果是,升级握手,添加websocket handler,如果不是,添加http handler

 

 

 

 

 

http :http://localhost:8990/fddfsfds

{"code":0,"message":"成功","result":"suc"}

websocket:http://localhost:8080/wechat-demo/websocket.html

posted on 2021-04-04 23:00  silyvin  阅读(1941)  评论(0)    收藏  举报