Git Product home page Git Product logo

Comments (4)

ycg000344 avatar ycg000344 commented on August 16, 2024 1

其他语言使用socket,按照视频里TLV这种传输格式来整理。这个msg的data已经是字节数据了, 按照业务设计model来转换,已经是自定义了。 :)

from zinx.

slowfall avatar slowfall commented on August 16, 2024

其他语言使用socket,按照视频里TLV这种传输格式来整理。这个msg的data已经是字节数据了, 按照业务设计model来转换,已经是自定义了。 :)

是否应该将 DataPack 解耦呢?目前 DataPack 是固定的包头长度、固定格式的 封包/拆包 ,如果遇到其他自定义的格式,就只能改源码来适配了...

from zinx.

im-zhangxi avatar im-zhangxi commented on August 16, 2024

@slowfall 遇到了同样的问题. 作为乙方. message 以及datapack 都跟框架不一样

from zinx.

aceld avatar aceld commented on August 16, 2024

@im-zhangxi @volgariver6 DataPack在上几个版本已经进行解耦,应用方重写

type IDataPack interface {
	GetHeadLen() uint32                //获取包头长度方法
	Pack(msg IMessage) ([]byte, error) //封包方法
	Unpack([]byte) (IMessage, error)   //拆包方法
}

然后通过IServerSetPacket(IDataPack)设置。

或者通过创建Server从Option传递Hook方法来设置,如下:

	//创建一个server句柄
	s := znet.NewServer(znet.WithPacket(myPack))

from zinx.

Related Issues (20)

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.