7 months ago

TCP Socket Connection between laravel and Socket Server using reacthphp

Posted 7 months ago by muzafferdede

I have posted in reactphp github but maybe someone here would be interested to give me some idea. if you quickly checkout this github post.

Basically i am trying to make a socket server and client with laravel.

I have done almost 90% of what i want to do but i am stock with a logic issue and can't figure it out.

To make it more clear:

  • There is a Remote Socket server (Laravel App) (running as daemon)
  • There is a Local Socket Client (Laravel App) (running as daemon)
  • Socket Client did connect to Socket Server using php artisan command and said "hi"
  • Socket Server got this message and said "hi back"

Until here every thing is fine. My issue starts when:

Let's say sometime in future one of the API request needs to send a request to Socket server and get response from it. How can i reference the existing connection from API controller to send it a write command ?

Should i use service providers? i don't know... :(

Please sign in or create an account to participate in this conversation.