Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Question: accessing websocket from manager process #446

Open
netdown opened this issue Nov 3, 2020 · 0 comments
Open

Question: accessing websocket from manager process #446

netdown opened this issue Nov 3, 2020 · 0 comments
Labels

Comments

@netdown
Copy link
Contributor

netdown commented Nov 3, 2020

Hi,
I am working on integrating the Swoole Timer and making the schedule ran by it instead of cron. Actually this part is done (but probably the scheduler should be expanded to handle intervals more frequent than a minute) and I am willing to release the source code.

However, I had less success with websockets. First of all, am I correct that only one swoole websocket server is being created?

It's quite tricky to bind a swoole timer, I had found out that the swoole.start events are the only suitable places. If I listen to the swoole.start event, I cannot access the websocket facade, like it had not been initialized at all. Obviously, If I choose the swoole.workerStart event, I will create multiple timers as this code gets executed upon each worker creation. There could be a hacky solution to make sure only one timer is created with the latter event, but if only one websocket server is running, there must be a way to access it from the manager process. Can you help me out with this one?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants