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
feature request websocketconnections :PluginKeyword #6
Comments
On 2019-07-15 01:39 PM, hypericum wrote:
You're very welcome. ^.^
You are right. I should make this easier via a keyword. In the meantime, you could do
I'll try to add the new keyword later on today. Hang tight! :-) |
this works well as long as I'm in the same scope of MyApp... If I'm correct in
@connections wouldn't be available any more. I've solved it by putting the $Conn->id into the config like:
in MyApp::Foo::Bar:FooBar sending a message works like that:
...so the main point would be to access @connections from Dancer Packages deeper down in the application, a
wouldn't be the problem in MyApp::Foo::Bar:FooBar, important would be that the same module-variable @connections would be presented. ;) THX a lot for your perspective "I'll try to add the new keyword later " ^^ |
Yes, true. But if you want to access it from elsewhere, switch the |
This being said, the new keyword websocket_connections is available in the release that I just punted to cpan. :-) |
Hi Yanik,
thank you very much for your great Dancer2::Plugin::WebSocket!
I have one little question that I haven't found an answer yet:
How do I send a new WebSocket Message from a Dancer Server through one of the open Sockets to a Client? (not in direct-reply to an incoming message from the client e.g. on_message or something similar)
The documented part (on_message,...) works well, connections are held open and can be found inside the Dancer2::Plugin::WebSocket object.
I'm missing something like:
instead of just:
or at least:
Dancer2::Plugin::WebSocket->connections->{$MyClientWebSocketConnectionID}->send($Message);
The shortest way I've found to send a message through an active websocket connection outside the main .pm was:
If you know a better way please enlight my humble mind :)
Thank you,
Johannes
The text was updated successfully, but these errors were encountered: