w.k
w.k

Reputation: 8386

Why this Mojolicious websockets example does not work?

I have tried some websockets simple examples to try them out, but no one works for me. Here is one example A WebSocket Mojolicious/DBI Example

I run it with plackup on port 5000 and everything should work fine. But when trying add some record i see on terminal just:

[Sat Mar  9 11:05:57 2013] [debug] GET /insert (Anonymojo).
[Sat Mar  9 11:05:57 2013] [debug] Template "not_found.development.html.ep" not found.
[Sat Mar  9 11:05:57 2013] [debug] Template "not_found.html.ep" not found.
[Sat Mar  9 11:05:57 2013] [debug] Rendering cached inline template.
[Sat Mar  9 11:05:57 2013] [debug] Rendering cached inline template.
[Sat Mar  9 11:05:57 2013] [debug] 404 Not Found (0.012583s, 79.472/s).
127.0.0.1 - - [09/Mar/2013:11:05:57 +0200] "GET /insert HTTP/1.1" 404 6440 "-" "-"

I get the almost same (exept UserAgent part) result when I target browser on "/insert".

In example script websockets route is defined but it gets never hit:

# setup websocket message handler
websocket '/insert' => sub {

So, what may be wrong here?

Upvotes: 2

Views: 905

Answers (1)

Joel Berger
Joel Berger

Reputation: 20280

Websockets (and the other real-time features too IIRC) only work with the Mojolicious servers: daemon, morbo and hypnotoad. Does your example work under say morbo?

Upvotes: 7

Related Questions