Comments (4)
其他语言使用socket,按照视频里TLV这种传输格式来整理。这个msg的data已经是字节数据了, 按照业务设计model来转换,已经是自定义了。 :)
from zinx.
其他语言使用socket,按照视频里TLV这种传输格式来整理。这个msg的data已经是字节数据了, 按照业务设计model来转换,已经是自定义了。 :)
是否应该将 DataPack 解耦呢?目前 DataPack 是固定的包头长度、固定格式的 封包/拆包 ,如果遇到其他自定义的格式,就只能改源码来适配了...
from zinx.
@slowfall 遇到了同样的问题. 作为乙方. message 以及datapack 都跟框架不一样
from zinx.
@im-zhangxi @volgariver6 DataPack在上几个版本已经进行解耦,应用方重写
type IDataPack interface {
GetHeadLen() uint32 //获取包头长度方法
Pack(msg IMessage) ([]byte, error) //封包方法
Unpack([]byte) (IMessage, error) //拆包方法
}
然后通过IServer
的SetPacket(IDataPack)
设置。
或者通过创建Server从Option传递Hook方法来设置,如下:
//创建一个server句柄
s := znet.NewServer(znet.WithPacket(myPack))
from zinx.
Related Issues (20)
- zinx这种情况是否需要加锁 HOT 1
- CPU百分百-不懂就问系列 HOT 3
- 消息ID HOT 1
- connection StartReader 处理数据,解码之后只有数据前8位,导致数据丢失 HOT 11
- 冰哥,最新更新消息丢给责任链这个源码,看不懂,能不能开个教程啊! HOT 4
- 连接id,只能固定系统自动生成吗? HOT 2
- [Bug]: 程序卡死 HOT 5
- Join the Zinx community (加入Zinx Issue讨论社区)
- 针对自定义的消息体实现IMessage,如何定义?
- 请教一个关于多server的问题 HOT 1
- 生产环境下的log HOT 1
- connection.go can't use c.cancel() HOT 1
- 2个问题 HOT 2
- 请教一个问题
- Support http interface HOT 1
- websocket 可以支持 TextMessage格式吗 HOT 1
- 责任链(chain)代码疑问
- v1.1.1运行mmo_game_client出现报错,求指教w HOT 1
- 头部内容固定,脏数据不能处理,一直阻塞到半包 HOT 3
- [feat]: 配置参数可以通过环境变量覆盖 HOT 1
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 zinx.