271 and 272 packets, notification question

Want to help out? Need help accessing the AniDB API? This is the place to ask questions.

Moderator: AniDB

Locked
MistaMuShu
Posts: 10
Joined: Sat May 28, 2005 2:50 am

271 and 272 packets, notification question

Post by MistaMuShu »

After sending AniDB a PUSH command, can 271 and 272 packets arrive at any time?

I'm asking because I'm curious why there's also a NOTIFY command alongside PUSH and 27x. I can see that it comes in handy as a keep-alive command every 30 minutes, but if AniDB will send out 27x for every notification concerning a user, why is there a need for NOTIFY and NOTIFYLIST?

Or is it possibly because NOTIFY and NOTIFYLIST are designed to be used separately from of PUSH and 27x packets? Which method is prefered and puts less stress on the server?
Knch
Posts: 5
Joined: Tue Jul 29, 2003 1:17 pm

Re: 271 and 272 packets, notification question

Post by Knch »

MistaMuShu wrote:After sending AniDB a PUSH command, can 271 and 272 packets arrive at any time?
As I see it, yes. (It'd be quite useless if a notification couldn't arrive at any time)
MistaMuShu wrote:I'm asking because I'm curious why there's also a NOTIFY command alongside PUSH and 27x. I can see that it comes in handy as a keep-alive command every 30 minutes, but if AniDB will send out 27x for every notification concerning a user, why is there a need for NOTIFY and NOTIFYLIST?
AniDB will send a 27x for every notification that's added after the PUSH command has been enabled. It won't send you any info about notifications/messages already pending before the PUSH command was sent. It's for those notifications that NOTIFY/LIST/GET exsist.
MistaMuShu wrote:Or is it possibly because NOTIFY and NOTIFYLIST are designed to be used separately from of PUSH and 27x packets? Which method is prefered and puts less stress on the server?
The PUSH command should be used if you want to be notified of new notifications, it will require less traffic as it will send you the data when new notifications arrive.

I've been thinking about writing a client myself and this is how I think it should be used:
Log in (obviously)
Enable notifications (PUSH)
Verify if no notifications/messages have arrived before we enabled the notifications (NOTIFY)
If so get those notifications (NOTIFYLIST/GET)
MistaMuShu
Posts: 10
Joined: Sat May 28, 2005 2:50 am

Post by MistaMuShu »

In the client that I'm working on, I have a wrapper object called AniDBConnection that handles the details of sending and decoding commands. All of the commands seem trivial to implement except I'm running into some trouble with 27x responses.

I tag each command I send with the command name and a timestamp. i.e. AUTH_12389531 so that I can verify an incoming response. So now I'm thinking I'll start a separate thread to listen for 27x notifications after I send the PUSH command.

Thanks for the clarification, what you said is mostly how I imagined it, but I just wanted some confirmation.
exp
Site Admin
Posts: 2438
Joined: Tue Oct 01, 2002 9:42 pm
Location: Nowhere

Post by exp »

another point is that UDP transfers are not secured. the notification notices send by anidb might get lost on the way and never reach the client.
that will become evident to the client when it issues the next NOTIFY command.

BYe!
EXP
Locked