Class: Rpush::Daemon::Dispatcher::ApnsHttp2

Inherits:
Object
  • Object
show all
Defined in:
lib/rpush/daemon/dispatcher/apns_http2.rb

Constant Summary collapse

URLS =
{
  production: 'https://api.push.apple.com:443',
  development: 'https://api.development.push.apple.com:443',
  sandbox: 'https://api.development.push.apple.com:443'
}
DEFAULT_TIMEOUT =
60

Instance Method Summary collapse

Constructor Details

#initialize(app, delivery_class, _options = {}) ⇒ ApnsHttp2

Returns a new instance of ApnsHttp2.



14
15
16
17
18
19
# File 'lib/rpush/daemon/dispatcher/apns_http2.rb', line 14

def initialize(app, delivery_class, _options = {})
  @app = app
  @delivery_class = delivery_class

  @client = create_http2_client(app)
end

Instance Method Details

#cleanupObject



25
26
27
# File 'lib/rpush/daemon/dispatcher/apns_http2.rb', line 25

def cleanup
  @client.close
end

#dispatch(payload) ⇒ Object



21
22
23
# File 'lib/rpush/daemon/dispatcher/apns_http2.rb', line 21

def dispatch(payload)
  @delivery_class.new(@app, @client, payload.batch).perform
end