[Request/Feature] Real-time bidirectional communication / inter-app communication #50661
Replies: 5 comments 7 replies
-
Hi, do you think if I can use "amphp/websocket-client" with reberb ? |
Beta Was this translation helpful? Give feedback.
-
Hey @roy-codeur I think basically, yes. That would be my idea, too. The only problem is that you would need to implement the Laravel Broadcasting Authentication within the websocket client to use private/presence channels. You could look into |
Beta Was this translation helpful? Give feedback.
-
Hello, after reviewing the code in the Laravel Reverb repository, I discovered a solution for Real-time bidirectional communication that worked for me. I created a listener named
Ensure that you use the
Here's an example of sending an event using Laravel Echo with Pusher from the client side:
|
Beta Was this translation helpful? Give feedback.
-
Hello. I really love reverb because it made our job much more efficient in terms of data requests. We are currently developing a chatbot and we use reverb as the process for sending the question to the backend server. The process is to send the message with echo Question, What is the purpose of |
Beta Was this translation helpful? Give feedback.
-
I guess, that wasn't a priority, because you could send client to server requests without websockets via an API. However, I do see that it may be convenient to do it both in the same way. This could even enable a package to implement something like waiting for a response to the event without coding its relation to the request sent, just by convention 🤔 |
Beta Was this translation helpful? Give feedback.
-
Hi,
sorry for cross-posting (see: Laracasts but I think this feature would be indeed very useful for multiple Laravel applications so I wanted to start a discussion about it over here.
I was very excited about the first release of Laravel Reverb. I really appreciate the effort to have a first party Laravel package for websocket communcation.
Right from https://reverb.laravel.com/ it says:
I am not sure if I get the wording/idea right, but I think Laravel Reverb is "just" a first party websocket server written in PHP. All known functionality from Laravel Broadcasting should work with Reverb. But from that statement above I really was hoping that Reverb adds client TO server communcation to Laravel's features as well. But I think that's not true (for now)?
Example
Currently I am working on a project where real-time communcation between a "Laravel Client" and a "Laravel Server" would be beneficial over just using HTTPS. You can imagine the project as a device management application. So there is a central server application that handles many devices in the field (like edge devices). As soon as a device turns on and has a working internet connection it connects to the central server. Because the devices may be in networks behind firewalls or even using cellular connections the communcation needs to be established from the client-side.
After the connection is established the devices should constantly push their diagnostics (like network connectivity, cpu/gpu usage etc..). For this a real-time communcation FROM the device TO the server would be very nice. But if I get it right Larvel Reverb also "just" enables server to client communication over websockets. So it is like a replacement for Laravel Websockets or Soketi. The mechanisms (pusher, websockets, redis..) are still the same. As well as the direction FROM server TO client.
Or am I missing something here?
Please don't get me wrong: I really like the idea of having a PHP first party package for this and I appreciate all the efforts to create such a package. Also Reverb seems to have "scalability in mind" which is also great. But I still miss bidirectional real-time communcation capabilities in Laravel. This would also be a nice feature to enable real-time communcation between two separate Laravel Apps (microservices!).
The idea
For my understanding this would require a "client"-side library that is able to connect to the websocket server and push messages to the server. This would also require a backend library to listen to these messagesand handle them properly.
There already is a websocket client and a websocket server over there @amphp.org but I think it would be nice to integrate this functionality directly into the new Laravel Reverb.
I would love to help implementing this feature but I am not sure where to start. In the sense of my use case I imagine the workflow being like:
How it could be done
What do you think about this idea? Is it possible and how could it be done?
Beta Was this translation helpful? Give feedback.
All reactions