Re: [mongrel2] python handler issue
- From:
- Dhruv Matani
- Date:
- 2011-08-02 @ 03:25
On Tue, Aug 2, 2011 at 7:31 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Sun, Jul 31, 2011 at 10:41:35PM -0700, Nathan Duran wrote:
>>
>> On Jul 31, 2011, at 10:35 PM, Dhruv Matani wrote:
>>
>> > I checked here to start with, but couldn't find any mention of "@*" on
>> > that page.
>>
>> There isn't one that I've seen, and I did get tripped up by this myself
for a few minutes when I first started building a custom Ruby handler, but
the reference Python implementation does illustrate proper handling of
disconnect messages.
>
> There's this now:
>
> http://mongrel2.org/static/mongrel2-manual.html#x1-790005.4
>
> But I'm thinking you're looking for:
>
> "Aside: HEY IMPLEMENTERS, HERE'S A LIST OF CRAP YOU KEEP GETTING
> WRONG:" and then just points like, disconnects, send_id/recv_id, etc.?
yeah! precisely! and a nice bold title along with it for people like me :)
basically, everything that needs to be handled in production, but is
never addressed in examples to keep the code small.
>
> Any others?
minor nit: is_disconnected() left me wondering what it means. Of
course, if you think a bit, it's obvious that it means "is the client
disconnected", but was wondering if it could be make more in-my-face.
Of course, changing API is bad, so I wouldn't insist.
Regards,
-Dhruv.
Re: [mongrel2] python handler issue
- From:
- Josh Simmons
- Date:
- 2011-08-02 @ 02:15
On Tue, Aug 2, 2011 at 12:01 PM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Sun, Jul 31, 2011 at 10:41:35PM -0700, Nathan Duran wrote:
>>
>> On Jul 31, 2011, at 10:35 PM, Dhruv Matani wrote:
>>
>> > I checked here to start with, but couldn't find any mention of "@*" on
>> > that page.
>>
>> There isn't one that I've seen, and I did get tripped up by this myself
for a few minutes when I first started building a custom Ruby handler, but
the reference Python implementation does illustrate proper handling of
disconnect messages.
>
> There's this now:
>
> http://mongrel2.org/static/mongrel2-manual.html#x1-790005.4
>
> But I'm thinking you're looking for:
>
> "Aside: HEY IMPLEMENTERS, HERE'S A LIST OF CRAP YOU KEEP GETTING
> WRONG:" and then just points like, disconnects, send_id/recv_id, etc.?
>
> Any others?
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>
So at some point has the disconnect message changed from
return self.headers['METHOD'] == 'JSON' and self.data.type == 'disconnect'
to a magic path? It's been a while since I've looked at the python
implementation.
Cheers,
Josh.
Re: [mongrel2] python handler issue
- From:
- Zed A. Shaw
- Date:
- 2011-08-02 @ 06:13
On Tue, Aug 02, 2011 at 12:15:08PM +1000, Josh Simmons wrote:
> So at some point has the disconnect message changed from
>
> return self.headers['METHOD'] == 'JSON' and self.data.type == 'disconnect'
>
> to a magic path? It's been a while since I've looked at the python
> implementation.
Ok, so this needs some docs, probably a walk through the python code so
people implementing their own won't freak and say "magic" when it
actually makes sense.
The original idea was "@*" would be a kind of "broadcast alert" saying
that any handler receiving this should process it. There's no
particular reason for picking it other than most of the time you
wouldn't have a route named that.
Then there's headers to check, in this case looking for the disconnect
message, which incidentally your clients can send as well to do this
gracefully for the json connections.
But, I'll write something up and explain it so that people know what it
does.
--
Zed A. Shaw
http://zedshaw.com/
Re: [mongrel2] python handler issue
- From:
- Dhruv Matani
- Date:
- 2011-08-02 @ 03:26
On Tue, Aug 2, 2011 at 7:45 AM, Josh Simmons <simmons.44@gmail.com> wrote:
> On Tue, Aug 2, 2011 at 12:01 PM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
>> On Sun, Jul 31, 2011 at 10:41:35PM -0700, Nathan Duran wrote:
>>>
>>> On Jul 31, 2011, at 10:35 PM, Dhruv Matani wrote:
>>>
>>> > I checked here to start with, but couldn't find any mention of "@*" on
>>> > that page.
>>>
>>> There isn't one that I've seen, and I did get tripped up by this
myself for a few minutes when I first started building a custom Ruby
handler, but the reference Python implementation does illustrate proper
handling of disconnect messages.
>>
>> There's this now:
>>
>> http://mongrel2.org/static/mongrel2-manual.html#x1-790005.4
>>
>> But I'm thinking you're looking for:
>>
>> "Aside: HEY IMPLEMENTERS, HERE'S A LIST OF CRAP YOU KEEP GETTING
>> WRONG:" and then just points like, disconnects, send_id/recv_id, etc.?
>>
>> Any others?
>>
>> --
>> Zed A. Shaw
>> http://zedshaw.com/
>>
>
> So at some point has the disconnect message changed from
>
> return self.headers['METHOD'] == 'JSON' and self.data.type == 'disconnect'
>
> to a magic path? It's been a while since I've looked at the python
> implementation.
yeah, agreed. maybe a doc. containing all magic paths with 1 line to
describe them.
Regards,
-Dhruv.