How to enable active sockets in a Mochiweb application?

4 views
Skip to first unread message

milouiuc

unread,
Nov 12, 2009, 11:50:57 AM11/12/09
to MochiWeb
Does anyone know how to enable active instead of passive sockets in a
Mochiweb application. Specifically, I am trying to adapt
http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-2
so that when a client disconnects, it will immediately "logout".

I have tried setting:

start(Options) ->
{DocRoot, Options1} = get_option(docroot, Options),
Loop = fun (Req) ->
Socket = Req:get(socket),
inet:setopts(Socket, [{active, once}]),
?MODULE:loop(Req, DocRoot)
end,

but that seems to not be working. I still only get updates in my
receive after I am sent a new message.

Thoughts? Thanks!
Reply all
Reply to author
Forward
0 new messages