简体   繁体   中英

Netty : URI Based Websocket networking

I'm on new on Netty framework.

I wrote some chatting module using it.

This is my simple chat server project snippet of ChannelInitializer .

protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline p = ch.pipeline();

        p.addLast(new HttpServerCodec())
                .addLast(new HttpObjectAggregator(65536))
                .addLast( new LoggingHandler(LogLevel.INFO))
                .addLast(new WebSocketServerProtocolHandler("/chat"))
                .addLast(new WsUserAcceptHandler())
...

This is very simple. Each handler check messages from /chat , and decides that handle or not.

But now, I want to give unique URI on each handler. Would you give me some tips?

I answered my own question later, Netty: How to use query string with websocket?

This code help to support multiple URI on netty.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM