Comments (8)
(1)Protobuf序列化的数据不包括消息类型,接受方没办法初始化对应的类型进行反序列化操作。(2)虽然netty中有了消息长度的编解码,但是这个长度是不定长的,所以接受方不能正常得到protobuf的数据内容。因为上面的原因,我也没想好怎么实现配合netty中protobuf的编解码。我的方式是和其他编解码结合使用。上面的截图是个不错的方案,不过为了安全起见,你最好在协议头中做一些扩展。 @WeikiForNtt
from rhsocketkit.
谢谢你提供的思路,另外请教下你所说的和其他编解码结合使用,具体是怎么使用的?和哪一个编解码结合使用的?
from rhsocketkit.
就按照上面图片中的协议结构 前面的几个数据字段是协议头 后面的protobufdata是数据内容 通过自定义的编码解码器得到protobufdata的数据内容 然后把这个protobufdata和data对应的结构类型丢给后面的protobuf编码解码器去处理解包 也就是包含了两个编码解码器 一个是自定义的编码解码器 另一个是protobuf的编码解码器
from rhsocketkit.
特别感谢@zhu410289616
from rhsocketkit.
你好!
参照了Netty的源码之后,我这边封装了一套编码解码器,可以完美支持netty自带的哪个编码解码器,我整理一下共有给你,还请指教!
在 2016-05-24 21:31:27,"朱如洪" [email protected] 写道:
就按照上面图片中的协议结构 前面的几个数据字段是协议头 后面的protobufdata是数据内容 通过自定义的编码解码器得到protobufdata的数据内容 然后把这个protobufdata和data对应的结构类型丢给后面的protobuf编码解码器去处理解包 也就是包含了两个编码解码器 一个是自定义的编码解码器 另一个是protobuf的编码解码器
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
from rhsocketkit.
@WeikiForNtt 厉害
qq:410289616 谢谢分享~哈哈
from rhsocketkit.
@WeikiForNtt 现在增加了正对netty的protobuf编解码了。
之前的多个编解码组合方式保留,增加了可以互通的嵌套方式。
使用方式在RHSocketKitDemo中。
from rhsocketkit.
同问一下,对于netty默认实现的ObjectEncoder()及ObjectDecider(),RHSocketKit中有对应的那一套编解码呢?还是同样需要自定义呢?刚接触这块,不懂请教
from rhsocketkit.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhsocketkit.