Think about Loose Coupling | |
PerlMonks |
Re: websocket infinit loopby Anonymous Monk |
on Dec 13, 2016 at 02:09 UTC ( [id://1177680]=note: print w/replies, xml ) | Need Help?? |
The infinite loop examples that I have found, are not suitable in this case because I need to use an infinite loop that can check for incoming data on both connections. Look at the Mojo examples, the entire premise, is there is one loop, when an event happens, a subroutine is called ( a call back), the callback does the checking for things its concerned about ( one connection, another connection, something else ) All you do is "register" subroutines to respond to events, an event is anything, from connecting to a socket, to getting a message, to a timer expiring ... Example Re^4: real-time output from Mojolicious WebSockets? All these things can be part of the same program, as long as you're not blocking for long, it all just keep running
In Section
Seekers of Perl Wisdom
|
|