I am newbie in websockets and swoole, herefore I understand, that i may do something wrong.
I have a project, where i need to send push messages to all connected websocket clients, for example i need to notify all users that there is new messages or tasks for them.
I expected to get list of all connected clients and then run through that list and send push to each fd... But I cannot do this direct, because server starts in SwooleService. Than i thought, that i need to create a task, that will run cli action, that will send pushes.... I created a mongoDb task and it runs my action, but i still can't get server instance to list clients....
My question is How can I broadcast a message to all connected clients?
Hi!
I am newbie in websockets and swoole, herefore I understand, that i may do something wrong. I have a project, where i need to send push messages to all connected websocket clients, for example i need to notify all users that there is new messages or tasks for them.
I expected to get list of all connected clients and then run through that list and send push to each fd... But I cannot do this direct, because server starts in SwooleService. Than i thought, that i need to create a task, that will run cli action, that will send pushes.... I created a mongoDb task and it runs my action, but i still can't get server instance to list clients....
My question is How can I broadcast a message to all connected clients?
Please, Help!