title: Use Nchan to post to logged in users only
body: <p>I am setting up an application with realtime events using nchan (<a href="https://github.com/slact/nchan" rel="nofollow noreferrer">https://github.com/slact/nchan</a>). The application itself is built on the Laravel framework. However, for now everyone that subscripes to specific sub-channel will get new events as soon infomation is pushed to the corresponing pub-channel.
  I want to limit that so only logged in users should be able to subscribe to events. Hence, if I am not logged in, it should not be possible to create a websocket and listen for events from for example <a href="http://www.example.com/chat/pubchat?id=some_id" rel="nofollow noreferrer">http://www.example.com/chat/pubchat?id=some_id</a>.</p>
  
  <p>Is there any way to make this possible?
  As far as I know, I cannot use Nginx/Nchan to make database queries to get only logged on users that way. And Laravel itself cannot limit subscribers since that is handled by Nginx/Nchan (but on the other side, can make database queries).</p>
  
  <p>Thanks for any tips!</p>
  
  <p>EDIT: Seems that I might can use the Drizzle module (<a href="https://github.com/openresty/drizzle-nginx-module" rel="nofollow noreferrer">https://github.com/openresty/drizzle-nginx-module</a>) and use the session ID as identifier. So if that ID is not present in the session table the connection will be blocked.</p>