PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, April 19, 2022

[FIXED] How to use PHP Laravel Binance web sockets?

 April 19, 2022     binance, laravel, php, ratchet, websocket     No comments   

Issue

In Laravel I made a test command and following this example implemented websocket client. It runs fine, but I am clueless how to launch it on server.

Controller? Does it keep running after page is loaded? Command? Does it keep running after ctrl+c? scheduler? Wont it launch new instance alongside existing ones every time?

Should I run it with supervisord? if so, should it be a command

[program:websockets]
command=php /var/www/laravel-app/artisan websocket_client:work
numprocs=1
autostart=true
autorestart=true
user=laravel-echo

or command=php /var/www/laravel-app/app/WebsocktClients/Binance.php?

How should I go about this?


Solution

The right answer was supervisord. Also I had to add some lines to throw exceptions when connection is closed to force worker restart, otherwise it might take some time (even hour) for process to stop after connection has been closed.



Answered By - Edmund Sulzanok
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing