Code Monkey home page Code Monkey logo

Comments (2)

walkor avatar walkor commented on August 22, 2024 1

感谢反馈。
造成这样结果的原因是这样的,gateway类似一个代理,客户端连接事件以及数据会被gateway转发到businessWorker的缓冲队列里,businessWorker从队列取出消息(onConnect、onWebSocketConnect、onMessage、onClose等消息)并处理,这样会有个延迟,所以businessWorker关闭连接后可能还会有数据包在队列里没有消费。

如果想在onWebSocketConnect和onConnect里关闭连接后不再收到数据,可以在start_gateway.php 里 利用$gateway->onConnect $gateway->onWebSocketConnect 代替Events.php里的onConnect和onWebSocketConnect。这样不会有延迟。

另外也可以在Events::onConnect或者Events::onWebSocketConnect做权限验证后记录一个$_SESSION['xx'],onMessage里判断$_SESSION['xx']是否存在,存在则认为是验证通过的,否则不处理直接返回

from gatewayworker.

lurrui avatar lurrui commented on August 22, 2024

感谢您提供的方法。应该没什么问题了。

from gatewayworker.

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.