Git Product home page Git Product logo

Comments (8)

zhu410289616 avatar zhu410289616 commented on September 16, 2024

2012102121555711
(1)Protobuf序列化的数据不包括消息类型,接受方没办法初始化对应的类型进行反序列化操作。(2)虽然netty中有了消息长度的编解码,但是这个长度是不定长的,所以接受方不能正常得到protobuf的数据内容。因为上面的原因,我也没想好怎么实现配合netty中protobuf的编解码。我的方式是和其他编解码结合使用。上面的截图是个不错的方案,不过为了安全起见,你最好在协议头中做一些扩展。 @WeikiForNtt

from rhsocketkit.

weiki08 avatar weiki08 commented on September 16, 2024

谢谢你提供的思路,另外请教下你所说的和其他编解码结合使用,具体是怎么使用的?和哪一个编解码结合使用的?

from rhsocketkit.

zhu410289616 avatar zhu410289616 commented on September 16, 2024

就按照上面图片中的协议结构 前面的几个数据字段是协议头 后面的protobufdata是数据内容 通过自定义的编码解码器得到protobufdata的数据内容 然后把这个protobufdata和data对应的结构类型丢给后面的protobuf编码解码器去处理解包 也就是包含了两个编码解码器 一个是自定义的编码解码器 另一个是protobuf的编码解码器

from rhsocketkit.

weiki08 avatar weiki08 commented on September 16, 2024

特别感谢@zhu410289616

from rhsocketkit.

weiki08 avatar weiki08 commented on September 16, 2024

你好!

参照了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.

zhu410289616 avatar zhu410289616 commented on September 16, 2024

@WeikiForNtt 厉害
qq:410289616 谢谢分享~哈哈

from rhsocketkit.

zhu410289616 avatar zhu410289616 commented on September 16, 2024

@WeikiForNtt 现在增加了正对netty的protobuf编解码了。
之前的多个编解码组合方式保留,增加了可以互通的嵌套方式。
使用方式在RHSocketKitDemo中。

from rhsocketkit.

wubuer avatar wubuer commented on September 16, 2024

同问一下,对于netty默认实现的ObjectEncoder()及ObjectDecider(),RHSocketKit中有对应的那一套编解码呢?还是同样需要自定义呢?刚接触这块,不懂请教

from rhsocketkit.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.