Skip to content
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

Access the loop from class #30

Open
elpoleto opened this issue Dec 3, 2018 · 5 comments
Open

Access the loop from class #30

elpoleto opened this issue Dec 3, 2018 · 5 comments

Comments

@elpoleto
Copy link

elpoleto commented Dec 3, 2018

Is there no way to access the main loop throught the application class? It would be useful to add timer etc

In ratchet is possible as (for example WebSocket Server):
$server = new IoServer(new HttpServer(new WsServer(new Chat($loop))), $socket, $loop);

@simonhamp
Copy link
Collaborator

@elpoleto I've not needed to do this before and haven't read up on this feature, so I'm not 100% clear on why you would do this. Could you provide a solid use-case?

@elpoleto
Copy link
Author

yes, sure, in my case i communicate with a iot device. for some actions i need the $loop->addTimer() to check a sort of timeouts but in my own class (in my case extends "RatchetWsServer") there is no access to the loop

@elpoleto
Copy link
Author

For now i implemented my own command and exclude the package one by composer.json as:
....
"autoload": {
"files": [
"app/Library/helpers.php",
"app/overrides/RatchetServerCommand.php"
],
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\": "app/"
},
"exclude-from-classmap": [
"vendor/askedio/laravel-ratchet/src/Console/Commands/RatchetServerCommand.php"
]
},
.....

all this to rewrite this simple call in method "createServerInstance()", that is private, to pass the $loop to the class
....
$this->serverInstance = $this->ratchetServer = new $class($this, $this->getEventLoop())
....

@elpoleto
Copy link
Author

elpoleto commented Jan 7, 2020

Is this project still alive?

@gcphost
Copy link
Contributor

gcphost commented Feb 4, 2020

Hi

We are looking for more maintainers and am happy to merge PRs but there is not much active development on this project.

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

No branches or pull requests

3 participants