Class: NotifyUser::APNConnection
- Inherits:
-
Object
- Object
- NotifyUser::APNConnection
- Defined in:
- app/models/notify_user/apn_connection.rb
Constant Summary collapse
- POOL =
ConnectionPool.new(size: ENV['APNS_CONNECTION_POOL_SIZE'] || 1, timeout: ENV['APNS_CONNECTION_TIMEOUT'] || 30) { APNConnection.new }
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize ⇒ APNConnection
constructor
A new instance of APNConnection.
- #reset ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize ⇒ APNConnection
Returns a new instance of APNConnection.
8 9 10 |
# File 'app/models/notify_user/apn_connection.rb', line 8 def initialize connection end |
Instance Method Details
#connection ⇒ Object
12 13 14 |
# File 'app/models/notify_user/apn_connection.rb', line 12 def connection @connection ||= setup_connection end |
#reset ⇒ Object
21 22 23 24 25 |
# File 'app/models/notify_user/apn_connection.rb', line 21 def reset @connection.close if @connection @connection = nil connection end |
#write(data) ⇒ Object
16 17 18 19 |
# File 'app/models/notify_user/apn_connection.rb', line 16 def write(data) raise "Connection is closed" unless @connection.open? @connection.write(data) end |