All, I'm currently playing with mojolicious for a prototype project and I like what I see. Apologies if my terminology is off, I'm still learning mojo:)
I've started to explore the idea of using mojo to replace some of our legacy embedded web based technologies and for a future embedded REST API, but I am struggling with how to integrate it to our event based back end. Specifically on how to generate an event from within Mojo::IOLoop. I know I can use a timer based approach, ie, wake up every second to see if an event has arrived, but it's not ideal for various reasons. The application itself is a C/XS based, and spawns a thread that runs perl code to provide a web based UI and API to monitor/control the application. Some of the older stuff is based on HTTP::Daemon while some of the newer stuff handles websockets based on Protocol::WebSocket so it's all low level and mojolicious would excel as a replacement. Many of the requests would block for a variety of reasons (ie, the response takes time) and the way we handle this is to have the perl code sitting on a select (IO::Select) statement which handles the raw websocket connection and a socket connection from inside our app. If a message is received on this app socket, we then read from our event message queue, process it and send it down the websocket. For the most part, this works well and results in mostly none blocking operation. I believe I can use the same approach of using a socket from the thread running mojo to the app, but I am unsure how to create this socket and associated it to Mojo::IOLoop to get callbacks etc? Is this raw socket approach the best solution, or are there other ways to get Mojo::IOLoop to wake up on an 'external event'? Thanks, -- 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.
