Handling Connections to the ServiceThere 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 ConnectionBy 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: - Connect to the service
- Send message / notification
- listen for response
- 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 Messageit 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: - Connect to the service
- Send a message / notification
- listen for response
- close connection
- repeat as needed for additional messages
This is suited if the application is sending a small amount of notifications infrequently. Batch Messages per ConnectionFinally, 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: - Connect to the service
- Send 1 or more messages / notifications
- listen for responses
- close connection
- repeat as needed for additional messages
This is useful if you need to send multiple messages on an infrequent interval.
|