netty / netty

Netty project - an event-driven asynchronous network application framework
http://netty.io
Apache License 2.0
33.3k stars 15.89k forks source link

should we add an muxer and demuxer as an specified channel handler to netty pipeline #1289

Open He-Pin opened 11 years ago

He-Pin commented 11 years ago

Hi netty team,should we add an muxer and demuxer as some specified channel handler,so that we could handle the message more flexible.

demuxer


                                               |------>inbound handler a
                                               |
--->inbound handler--->demuxer--(demuxer via situation)
                                               |
                                               |------>inbound handler b
                                               |...

muxer

muxer

                                             |<-------outbound handler c
                                             |
<---outbound handler<-----muxer---(muxer via situation)
                                             |
                                             |<---------outbound handler d
                                             |<---- ....
He-Pin commented 11 years ago

if you think this may be nice,I will going to handle it,this may be needed such as transfer the video and audio package on a single bytes channel,

the demuxer receive the origin package and then dispatch it to the next right handler in the pipeline.and and vice versa. there may have many other usage examples.

I think with this ,we will clean out some switch case in the MessageReceived() callback which we may need to detect the protocol type and then handle it in specified way.

wdyt.

normanmaurer commented 11 years ago

Sounds like this: #66 ?

He-Pin commented 11 years ago

@normanmaurer yeah,sounds like.So,what do you think to implement it ?

I think the muxer and demuxer would be nice.

He-Pin commented 11 years ago

jus as trustin said ,this is really needed for some web application ,which may be complex.

normanmaurer commented 11 years ago

@hepin1989 feel free to work on it :)

He-Pin commented 11 years ago

@normanmaurer ,you ,may want to say "feel free to work on it" :P

normanmaurer commented 11 years ago

yep ;)