Home > Archive > PERL POE > March 2008 > Sending event to interested sessions
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Sending event to interested sessions
|
|
|
| Sorry if this is a basic one...
I have a UI session that spawns a TCP client session (P::C::C::TCP). This client session will be emitting events primarily for the UI, but I do not want to "hardcode" the name of the ui session in the TCP client session.
Upon creating the TCP clent I can pass the UI session name (I assume) and use that as the session name in $kernel->post. But what if there are also other sesions that are interested in the events?
Is there a clean way of handling this?
Thanks,
John
| |
| Nicholas Perez 2008-03-28, 5:25 am |
| I'm sure you can ramrod a solution out of POE::Session::MultiDispatch
(http://search.cpan.org/~cwest/POE-S...ultiDispatch.pm)
But no, there really isn't an easy publish/subscribe component for
listing and listening for arbitrary events. I've had one in various
states of completion for quite sometime, but have yet to get enough
tuits to finish it (but finishing it is on the todo list).
If anything, you may just need to build a quick and dirty solution.
The mechanism isn't difficult.
If you are interested in fleshing out the paltry little snippets that
I've jotted down, I can nopaste you some code.
Also if you end up rolling your own, the very simple API for
POE::Component::Server::XMLRPC
(http://search.cpan.org/~mahex/POE-C...-0.05/XMLRPC.pm)
could be a good start.
Oh, and I call dibs POE::Component::PubSub :-D
On Thu, Mar 27, 2008 at 4:57 PM, John <johnr@wowway.com> wrote:
> Sorry if this is a basic one...
>
> I have a UI session that spawns a TCP client session (P::C::C::TCP). This client session will be emitting events primarily for the UI, but I do not want to "hardcode" the name of the ui session in the TCP client session.
>
> Upon creating the TCP clent I can pass the UI session name (I assume) and use that as the session name in $kernel->post. But what if there are also other sesions that are interested in the events?
>
> Is there a clean way of handling this?
>
> Thanks,
>
> John
>
--
Nicholas R. Perez
| |
|
| On Fri, Mar 28, 2008 at 12:02:49AM -0500, Nicholas Perez wrote:
[snip all sorts of good pointers and information]
It seems like most of the stuff I do with POE requires this kind of capability. I'll take a look at those items.
> Oh, and I call dibs POE::Component::PubSub :-D
Don't worry, my work usually starts and ends in POE::Component::Hack name space!
Thanks,
John
|
|
|
|
|