mod_perl server events for client
What is a good way to implement server to client callbacks (events) with a web service?
We already have a SOAP-based API exposed by mod_perl running on Apache, bu开发者_JAVA百科t it is one way client to server. We need to notify the client of certain changes on the server by other clients.
What is a good way to make this work? Available modules for perl?
One thing we thought of was to make a long running web request that would finally respond when an event occurred, but this would seem to keep too many mod_perl processes running if many clients were connected.
One way is the one you mentioned, long-running polls.
The other is websockets. There are many Perl frameworks which are able to deal with websockets requests, one of which is Mojolicious.
See the docs at Mojolicious::Lite#WebSockets for some examples.
I would suggest in your case running the websockets webapp separately from the mod_perl server, and "just" using Apache to reverse-proxy the mojolicious app.
Have you actually tried your first approach ? How many max concurrent clients would that be? A few dozens should be manageable by apache. Just guessing.
Have you tried this low-tech method "Watching long processes through CGI", or is it what you wanted to get rid of in the first place?
精彩评论