Coder Social home page Coder Social logo

请教一下client的问题 about tao HOT 3 OPEN

shinwing avatar shinwing commented on August 17, 2024
请教一下client的问题

from tao.

Comments (3)

leesper avatar leesper commented on August 17, 2024

@shinwing Hi,RPC我不是很了解,我说说我自己的思考哈。我感觉你担心的是消息是不是会发生“串号”的问题。那么一般来说server和client的通信是通过它们之间建立的connection来实现的,client在connection上发送一个request,server处理完毕后通过connection返回一个response。如果是推送一个push,那么可以双方约定一个协议号或者协议名称,client收到消息的时候先检查这个名称或者协议号,根据协议号来执行相应的业务逻辑,这样是不是就可以区分了呢?我在tao框架中用的是协议号,不过这是山寨做法,更好的做法,你可以参考陈硕的这篇blog一种自动反射消息类型的 Google Protobuf 网络传输方案

对于pingpong那个例子而言,如果返回值不只一个,我们同样可以采用协议号或者协议名称的方式来区分并建立不同的处理逻辑。

不知道我的回答有没有解决你的问题呢

from tao.

shinwing avatar shinwing commented on August 17, 2024

非常感谢回复。大抵思路我也看了,和您说的差不多。
唯一一点小问题是,用协议号和名称应该是不行的,原因是因为同名的方法重复发送的时候,其实如果需要严格对照返回值,会对比不上。

所以可能是加上一个seq之类的。具体我今天打算参照一下rpcx的做法。

再次感谢回复。

from tao.

leesper avatar leesper commented on August 17, 2024

@shinwing 不客气,我也是初学者

from tao.

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.