My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 13, 2008 by mikechambers
Labels: Featured
HandlingConnections  
Strategies for how to handle the connection to the service.

Handling Connections to the Service

There are three primary strategies on how to manage the connection to the service. Which strategy is best for your application will depend on the application itself.

Persistent Connection

By default, the GrowlService API will make a persistent connection to the Growl service and maintain it through the lifetime of the application.

In this case, the application will:

  1. Connect to the service
  2. Send message / notification
  3. listen for response
  4. repeat as needed for additional messages (without having to explicitly connect again)

This can be useful if an application is sending frequent notifications and / or Growl events may be sent back to the application after a significant delay.

Connection Per Message

it is also possible to use the library so that it only maintains the connection for as long as is needed to send a message / notification. In this case, the application will:

  1. Connect to the service
  2. Send a message / notification
  3. listen for response
  4. close connection
  5. repeat as needed for additional messages

This is suited if the application is sending a small amount of notifications infrequently.

Batch Messages per Connection

Finally, it is also possible to use the library in a way that it sends multiple messages at a time. In this case, the application will:

  1. Connect to the service
  2. Send 1 or more messages / notifications
  3. listen for responses
  4. close connection
  5. repeat as needed for additional messages

This is useful if you need to send multiple messages on an infrequent interval.


Sign in to add a comment
Hosted by Google Code