Send message to all connected Clients

Stephen Pape Stephen.Pape.ctr at RL.af.mil
Wed Dec 9 15:29:19 EST 2009


Hi,

I've been looking into this same problem. It'd seem you'd have to serialize
the object ahead of time, outside of Netty, into a ChannelBuffer. From there
you can call ChannelGroup.write() and just send the ChannelBuffer.

This avoids the serialization overhead, but it doesn't fit well into my
design. I'd like to reuse the single channels and somehow add a multiplexer
into the pipeline. Maybe intercepting the handleUpstream call and taking the
ChannelBuffer, then passing it off to the ChannelGroup? I'm not sure how
this'd work with ChannelFuture though.

-Stephen


Sergey S wrote:
> 
> Hi
> 
> there is perfomance issue with ChannelGroup.write method. Written object
> will be serialized N times for ChannelGroup of N channels. Do you know how
> to avoid this serialization overhead?
> 
> 
> Sebastian Andersson wrote:
>> 
>> On Tue, Oct 13, 2009 at 19:40, nettyuser <nettyuser at mailinator.com>
>> wrote:
>>> I would like to send some messages from the server to all the connected
>>> clients. Can someone please let me  know the proper way to do this using
>>> Netty API.
>> 
>> Store the Channels in a ChannelGroup when they connect and then send
>> the message to the ChannelGroup.
>> Its used in one of the examples, the chat-server I believe.
>> 
>> /Sebastian
>> 
>>>
>>> Thanks.
>>>
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/Send-message-to-all-connected-Clients-tp3817609p3817609.html
>>> Sent from the Netty User Group mailing list archive at Nabble.com.
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>> 
>> 
>> 
>> -- 
>> One laptop per child project: http://laptop.org/
>> 
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Send-message-to-all-connected-Clients-tp3817609p4141768.html
Sent from the Netty User Group mailing list archive at Nabble.com.



More information about the netty-users mailing list