Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using WS message in event loop #128

Open
makopov opened this issue Sep 9, 2022 · 0 comments
Open

Using WS message in event loop #128

makopov opened this issue Sep 9, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@makopov
Copy link

makopov commented Sep 9, 2022

I have 3 questions here...

  1. I'm trying to figure out how to pass the message received by the WS to the event loop, see code below.
  2. Is this the right way to handle ws messages asynchronously? I notice delays with the more topics I subscribe to.
  3. My IDE is showing that React Factory is deprecated, are there plans to stop usages of it in the future?
        $loop = Factory::create();
        $loop->addPeriodicTimer(1, function($message) {
           var_dump('loop: ' . date('Y-m-d H:i:s'));
           var_dump($message);
        });
        $api->setLoop($loop);

        $api->subscribePublicChannels($query, $channels, function (array $message, WebSocket $ws, LoopInterface $loop) use(&$exchange, &$interval, &$results) {
            // $loop->run();
            // print $message['data']['symbol'] . PHP_EOL;

            }
        }, function ($code, $reason) {
            echo "OnClose: {$code} {$reason}\n";
        });
@ISAAC-XXYYZZ ISAAC-XXYYZZ self-assigned this Aug 15, 2024
@ISAAC-XXYYZZ ISAAC-XXYYZZ added the enhancement New feature or request label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants