为什么这个Mojolicious websockets示例不起作用?

w.k*_*w.k 2 perl websocket mojolicious

我已经尝试了一些简单的示例来尝试它们,但没有人适合我.这是一个WebSocket Mojolicious/DBI示例的示例

我在端口5000上使用plackup运行它,一切都应该正常工作.但是当我尝试添加一些我在终端上看到的记录时:

[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 "-" "-"
Run Code Online (Sandbox Code Playgroud)

当我在"/ insert"上定位浏览器时,我得到几乎相同的(exept UserAgent部分)结果.

在示例脚本中,定义了websockets路由,但它从未被命中:

# setup websocket message handler
websocket '/insert' => sub {
Run Code Online (Sandbox Code Playgroud)

那么,这里可能有什么问题?

Joe*_*ger 7

Websockets(以及其他实时功能IIRC)仅适用于Mojolicious服务器:守护进程,morbo和hypnotoad.你的例子在morbo下工作吗?

  • 我对人们对这些帖子的评论感到惊讶!我应该说,数据库代码是非常基本的,可能无法正确地在preforking(hypnotoad)环境中工作.我应该回去更新它们.它们仍然适合于介绍,这就是它们的本质.祝好运! (2认同)