|
Hi,
Sent you edits in github.
Looks like $self is undef because you have a typo when setting it
in wsinit().
Also, looking at the docs it seems websocket() just creates a GET
handler for the initial websocket handshake, if you want to
actually send anything, you need to subscribe to a "message" event
in your action.
On 15/05/16 19:17, john wrote:
I
have written mojo lite based websocket applications but am having
problems with my first attempt at a full application:
https://github.com/john-/mojo_inotifier
Here is what happens::
morbo script/inotifier
Server available at MailScanner warning: numerical links are often malicious: http://127.0.0.1:3000
[Sun May 15 10:57:08 2016] [debug] GET "/"
[Sun May 15 10:57:08 2016] [debug] Routing to controller
"Inotifier::Controller::Actions" and action "base"
[Sun May 15 10:57:08 2016] [debug] Rendering template
"base.html.ep"
[Sun May 15 10:57:08 2016] [debug] Template
"layouts/default.html.ep" not found
[Sun May 15 10:57:08 2016] [debug] 200 OK (0.006929s, 144.321/s)
[Sun May 15 10:57:08 2016] [debug] GET "/wsinit"
[Sun May 15 10:57:08 2016] [debug] Routing to controller
"Inotifier::Controller::Actions" and action "wsinit"
[Sun May 15 10:57:08 2016] [error] Can't call method "app" on an
undefined value at lib/Inotifier/Controller/Actions.pm line 15,
<DATA> line 2231.
[Sun May 15 10:57:08 2016] [debug] Template
"exception.development.html.ep" not found
[Sun May 15 10:57:08 2016] [debug] Template "exception.html.ep"
not found
[Sun May 15 10:57:08 2016] [debug] Rendering template
"mojo/development.html.ep"
[Sun May 15 10:57:08 2016] [debug] Rendering template
"mojo/mojobar.html.ep"
[Sun May 15 10:57:08 2016] [debug] 500 Internal Server Error
(0.035149s, 28.450/s)
in wsinit $self for this route is undef. This means to me I am
doing something wrong with my route definition:
$r->websocket('/wsinit')->to(controller => 'actions',
action ="" 'wsinit');
I tried alternate ways such as
"$r->websocket('/wsinit')->to('actions#wsinit');" with the
same result.
What am I missing here?
Thanks,
John
--
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
|