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)
- 如果在同一台服务器初始化了两个server,初始化服务器顺序不同,导致routerslice问题 HOT 1
- 请问怎么构建一个websocket的client? HOT 1
- 关闭服务时,书写重复代码 HOT 1
- RouterSlices中Handlers的意义还存在逻辑错误 HOT 1
- connection.go SendBuffMsg函数代码重复 HOT 3
- clone函数切片应该使用深拷贝 HOT 5
- Request stepLock and Chain.Proceed
- 在zinx中网关节点做转发协议该如何配置路由? HOT 3
- How to send mesaage from server to cleint? HOT 2
- 支持TLS吗? HOT 1
- windows上通信,路由的触发会存在卡顿的情况 HOT 3
- [Warnning]: Request 对象池机制问题 HOT 2
- 如果我用其他语言写一个客户端,怎么才能触发路由 HOT 3
- 怎么能设置 拨号的超时时间 HOT 1
- [Panic]: send on closed channel
- decoder、pack、framedecoder HOT 1
- znet/request.go 文件中Request对象index成员的初始值问题
- 拦截器中获取msgid,一直为0 HOT 4
- 支持公网和内网服务器之间通信吗(内网穿透) HOT 1
- zinx 安裝失败 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.