358
edits
No edit summary |
|||
Line 26: | Line 26: | ||
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications | * Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications | ||
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs. | * IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs. | ||
* Use NOTIFYGET to receive a notification, suppling the ID provided by NOTIFYLIST | |||
* Use NOTIFYACK to acknowledge a notification, suppling the ID provided by NOTIFYLIST (if desired) | |||
{{eyecatch|NOTE|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str type value with indicate what entity the ID represents.}} | |||
'''Method Two: Server PUSH''' | |||
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive these advisements, and will be responsible for keeping the login session from timing out, and any NAT router ports open. | |||
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here. | |||
A PUSH HOWTO: | |||
* PUSH to register your client session. | * PUSH to register your client session. | ||
* Listen for 271-274 NOTIFICATIONs ('''not 290'''). | * Listen for 271-274 NOTIFICATIONs ('''not 290'''). | ||
* PUSHACK the | * Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION | ||
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID) | |||
* Use NOTIFYGET to receive a notification | * Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired) | ||
* Use NOTIFYACK to acknowledge a notification ( | |||
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags. | It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags. | ||