http://www.perlmonks.org?node_id=1092866


in reply to Re: Mojolicious: Websocket example under hypnotoad
in thread Mojolicious: Websocket example under hypnotoad

This is an example of chat application.

This is Mojolicious application and it can be run in different ways.

One of the ways to run under the hypnotoad.

What is Hypnotoad?

Hypnotoad is a full featured, UNIX optimized, preforking non-blocking I / O HTTP and WebSocket server, built around the very well tested and reliable Mojo :: Server :: Prefork, with IPv6, TLS, Comet (long polling), keep-alive, connection pooling, timeout, cookie, multipart, multiple event loop and hot deployment support that just works.

Hypnotoad is PREFORKING server therefore has many processes (workers). Variable $clients contains references to objects Mojo::Transaction. This object is required for calling send_message (send a message to the chat user)

The problem is that this variable is not shared between workers. And connected users in the one worker are not visible in another.

I'm trying to solve this problem.

If you are after these explanations did not understand anything then do not worry about it

Thanks