lib/apn_on_rails/app/models/apn/notification.rb
# Creates the binary message needed to send to Apple.
Creates the binary message needed to send to Apple.
Creates the binary message needed to send to Apple .
def message_for_sending
    json = self.to_apple_json
    device_token = [self.device.token.gsub(/[<\s>]/, '')].pack('H*')
    message = [0, 0, 32, device_token, 0, json.bytes.count, json].pack('ccca*cca*')
    raise APN::Errors::ExceededMessageSizeError.new(message) if message.size.to_i > 256
    message
  end
def message_for_sending json = self . to_apple_json device_token = [ self . device . token . gsub ( / [< \s >] / , '' ) ] . pack ( 'H*' ) message = [ 0 , 0 , 32 , device_token , 0 , json . bytes . count , json ] . pack ( 'ccca*cca*' ) raise APN :: Errors :: ExceededMessageSizeError . new ( message ) if message . size . to_i > 256 message end
Creates the binary message needed to send to Apple.
Creates the binary message needed to send to Apple .