ReactPHP Tutorial #5: Simple Chat With Sockets - Client

preview_player
Показать описание
=====================

Books:
=====================

Рекомендации по теме
Комментарии
Автор

Hi Sergey,

I want to create one application where I have some UI and chats are updated realtime using reactphp and laravel.

Please come to achieve this. I'm very much struggling in this.

rakeshpatel
Автор

Hi, I have created a socket server and it works fine when i use telnet to connect and communicate. Now i am trying to build a client using laravel. But i am not sure what to follow or have an idea to implement. I know i can connect to server and send and receive data for the first time but don't know how can i send new commands to that existing connection when some events happened in future.


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 ?

I need a way to reference $connection and send a write command to the socket server $connection->write('new msg")

I wish you could make a video about this.

Thanks

dramen
Автор

Great !, please an example with javascript client

EstebanYomairo
Автор

Do you think it is possible to write symfony question helper in the client code and pass the input server ?

raheelmasood