Yes exactly like this

> Am 12.04.2019 um 08:19 schrieb Frederic <[email protected]>:
> 
> You can create one buffer and then use to send to all your sockets the very 
> same buffer content but using different indexes (read here) using the 
> ByteBuf.duplicate() method.
> 
> https://netty.io/4.1/api/io/netty/buffer/ByteBuf.html#duplicate--
> 
> Javadoc says:
> 
> public abstract ByteBuf duplicate()
> Returns a buffer which shares the whole region of this buffer. Modifying the 
> content of the returned buffer or this buffer affects each other's content 
> while they maintain separate indexes and marks. This method does not modify 
> readerIndex or writerIndex of this buffer.
> The reader and writer marks will not be duplicated. Also be aware that this 
> method will NOT call retain() and so the reference count will NOT be 
> increased.
> 
> Returns:
> A buffer whose readable content is equivalent to the buffer returned by 
> slice(). However this buffer will share the capacity of the underlying 
> buffer, and therefore allows access to all of the underlying content if 
> necessary.
> 
> Le vendredi 12 avril 2019 06:31:57 UTC+2, [email protected] a écrit :
>> 
>> Are there any optimizations available if I'd like to send the very same data 
>> to dozens (or hundreds) of Websocket channels?
>> At a minimum I'd like to avoid creating (and copying) the data to new 
>> buffers. Ideally I would provide a single buffer and a list of channels.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Netty discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netty/4c93f31c-a1f0-48be-94ef-b7cda094e2c5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/07CCA5A5-7DF6-47B4-BAE3-B02BA13B4543%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to