Netty小记——web socket分片聚合实现

本文介绍了在Netty中如何利用WebSocketFrameAggregator处理WebSocket的分片聚合。WebSocketFrameAggregator作为MessageAggregator的子类,负责在Channel Pipeline中识别并聚合需要聚合的消息。通过判断消息类型和是否为最后一个分片,实现分片的合并。同时提到,对于大消息内容,可以考虑使用压缩的WebSocket传输方式。
摘要由CSDN通过智能技术生成

在netty中已经对web socket的分片重组进行了相应的实现,具体的实现类是 WebSocketFrameAggregator,该类继承自netty的消息聚合器MessageAggregator。

MessageAggregator

 ......

 * @param <I> the type that covers both start message and content message
 * @param <S> the type of the start message
 * @param <C> the type of the content message (must be a subtype of {
  @link ByteBufHolder})
 * @param <O> the type of the aggregated message (must be a subtype of {
  @code S} and {
  @link ByteBufHolder})
 *
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值