lib/apnserver/notification.rb in bpoweski-apnserver-0.1.2 vs lib/apnserver/notification.rb in bpoweski-apnserver-0.1.3
- old
+ new
@@ -32,13 +32,15 @@
def push
if Config.pem.nil?
socket = TCPSocket.new(Config.host || 'localhost', Config.port.to_i || 22195)
socket.write(to_bytes)
+ socket.close
else
client = ApnServer::Client.new(Config.pem, Config.host || 'gateway.push.apple.com', Config.port.to_i || 2195)
client.connect!
client.write(self)
+ client.disconnect!
end
end
def to_bytes
json = json_payload