Sha256: d483d21d137038bd9eebc0c10aebeba8f83ca1a4aab640cac9b67f3ca852f53c

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

require 'apns_gatling'
require 'openssl'

team_id = '3KCK45MYQ3'
auth_key_id = 'EXZ572VG95'
auth_key_file = './APNsAuthKey_EXZ572VG95.p8'
ecdsa_key = OpenSSL::PKey::EC.new File.read auth_key_file

def message(body)
  msg = ApnsGatling::Message.new '609b0f73f2809bf1ce699f3b6ddecfcf5e134a102f5574d665cf30c33d2544c5'
  msg.alert = {title: "hello", body: body}
  msg.topic = 'com.fplus.Central'
  msg
end

client = ApnsGatling::Client.new team_id, auth_key_id, ecdsa_key, true

6.times do |i|
  puts "num #{i}"
  client.push(message("test #{i}")) do |r|
    puts "num #{i} success: #{r.ok?}, error: #{r.error}"
  end
end

loop {
  sleep 1
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apns_gatling-0.2.2 examples/push_message.rb
apns_gatling-0.2.1 examples/push_message.rb
apns_gatling-0.2 examples/push_message.rb