Broadcasting and Encoding

Don Park donpark at docuverse.com
Fri Mar 5 16:07:39 EST 2010


Hi.

While using a ChannelGroup to broadcast some JSON messages to multiple
WebSocket channels, I ran into some design issues:

1. Writing JSONObject to the ChannelGroup leads to JSONObject being encoded
to WebSocketFrame once per channel which doesn't scale well (at least for my
use case).

2. Writing WebSocketFrame to the ChannelGroup after directly encoding
JSONObject to WebSocketFrame doesn't work because WebSocketFrame's internal
binaryData's readerIndex is not restored, delivering the message to only the
first channel.

3. Writing ChannelBuffer to the ChannelGroup after directly encoding
JSONObject to ChannelBuffer forces me to duplicate code within
WebSocketEncoder because WebSocketEncoder is designed to work within a
pipeline and not as a utility class.

Perhaps I am overlooking something but I think ChannelGroup could use it's
own pipeline of encoders to encode high-level objects down to ChannelBuffer
which it knows how to handle.

Best,

Don park

-- 
View this message in context: http://n2.nabble.com/Broadcasting-and-Encoding-tp4683421p4683421.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list