Closed mlangenberg closed 11 years ago
Thanks for all of your contributions, @mlangenberg. Some thoughts about this particular PR:
Houston is designed the way it is to accommodate both basic and advanced use cases simply. If you're just sending a few notifications occasionally, Houston::Client
makes it easy, managing the connection for you.
Advanced usage, such as scheduling with a queueing service or background worker means managing the Houston::Connection
object manually. This level of abstraction is acceptable for the advanced use case, and is indeed desirable, as less or indirect control over this would limit the range of how people might use it.
The problem with making Houston::Client
a persistent connection by default is that I don't expect these objects to be long-lived, like a managed connection might be.
When you hold a
Houston::Client
, calling#push
should be responsible for opening and closing the connection.Apple advices to use persistent connections, and this should be the default for any library talking to the APN-service. This pull request is a little rough, but it demonstrates how one could use Houston for a persistent connection to apple, while still making use of the error handling code in Houston::Client.
Before
After
Also started on some tests.