nomad/houston — pull request #25 by mlangenberg (2013-10-25 12:33:07+00:00)
Title: Persistent by default

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
```ruby
connection = Houston::Connection.new(APPLE_DEVELOPMENT_GATEWAY_URI, certificate, passphrase)
connection.open

notification = Houston::Notification.new(device: token)
notification.alert = "Hello, World!"
connection.write(notification.message)
# connection.read(6) or what?
```

## After
``` ruby
client = Houston::Client.development certificate: certificate, passphrase: "..."
notification = Houston::Notification.new(device: token)
notification.alert = "Hello, World!"
client.push(notification) # error handling, converts notification to byte string for you.
```

Also started on some tests.