-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
How to send a message to the client from the backend server ? #867
Comments
Create an http_worker in ws_worker's onWorkerStart, http_worker and ws_worker will be in the same process space,so http_worker can access any variables of ws_worker. When an external program wants to send ws data, it only needs curl call http_worker. The code looks like this.
Curl codes.
|
Hello! Server codes:
my CURL codes:
what am i doing wrong? help please. |
Hey! First of all, I want to thank you for your library.
I have a problem that I don't know how to solve yet.
I have a chat in which I implemented sending simple messages, everything works fine. Now I want to send files and ran into a problem with large file sizes. I decided not to load the connection socket and send files directly to the backend server via form/data.
BUT. How, after a successful send, initialize the user and send him a socket notification that his file was successfully sent? At the moment my code looks like this:
`
$ws_worker = new Worker('websocket://'.config('websockets.server'));
`
My problem is that I don't know where to store active user sessions. So that I can access them from other parts of the project. Now they are stored in my clients variable in the same place where the websocket server starts. Should they be stored elsewhere? Where do you recommend?
And also, please tell me how to send notifications to the desired connection from any part of the project. For example, I imagined it like this:
`
send_alert.php
`
The text was updated successfully, but these errors were encountered: