On Nov 28, 2012, at 9:21 AM, Jaro Zajonc <jaro.zaj...@gmail.com> wrote:

> But if I direct traffic from Apache directly to Twiggy server I'd bypass 
> Catalyst Authentication/Authorization part for Comet session, right? 
> I'd like to allow only authenticated users to subscribe to comet channel.
> I am sure I am missing some really simple piece of the puzzle :-\


I've been through the same dilemma. Solved it by sharing appropriate
data between Plack and Catalyst using 
Catalyst::TraitFor::Request::Plack::Session.
It's clumsy and I haven't thoroughly tested it, though… So, there might be 
(serious)
limitations.

Here's how it goes…  something along these lines:

builder {
  enable 'Session',
    store =>
    Plack::Session::Store::Cache->new( cache => CHI->new( driver => (…) ) );

  mount '/' => $catalyst_psgi_app;    # auth, etc..
                                      # (you're logging in first, aren't you?)

  # when you reach here, auth is already made
  # and Plack::Session is stuffed

  mount '/socket.io' => PocketIO->new(
    handler => sub {
      $_[1]->{'psgix.session'}->{can_foo};
    }
  );
};

… and then

> plackup -s AnyEvent::FCGI myapp.psgi

Also, here, a message queue suits it well for sharing data and
messaging passing, given you've already pointed the proper queue key
in session.
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to