Module: Expo::Push

Defined in:
lib/push/client.rb,
lib/push/chunk.rb,
lib/push/tickets.rb,
lib/push/receipts.rb,
lib/push/notification.rb,
lib/expo/server/sdk/version.rb

Overview

rubocop:disable Style/Documentation

Defined Under Namespace

Classes: ArgumentError, Chunk, Client, Error, Notification, PushTokenInvalid, Receipt, Receipts, ReceiptsWithErrors, ServerError, Ticket, Tickets, TicketsExpectationFailed, TicketsWithErrors

Constant Summary collapse

PUSH_NOTIFICATION_CHUNK_LIMIT =

The max number of push notifications to be sent at once. Since we can’t automatically upgrade everyone using this library, we should strongly try not to decrease it.

100
PUSH_NOTIFICATION_RECEIPT_CHUNK_LIMIT =

The max number of push notification receipts to request at once.

300
DEFAULT_CONCURRENT_REQUEST_LIMIT =

The default max number of concurrent HTTP requests to send at once and spread out the load, increasing the reliability of notification delivery.

6
BASE_URL =
'https://exp.host'
BASE_API_URL =
'/--/api/v2'
PUSH_API_URL =
"#{BASE_API_URL}/push/send"
RECEIPTS_API_URL =
"#{BASE_API_URL}/push/getReceipts"

Class Method Summary collapse

Class Method Details

.expo_push_token?(token) ⇒ Boolean

Returns ‘true` if the token is an Expo push token

Returns:

  • (Boolean)


149
150
151
152
153
154
# File 'lib/push/client.rb', line 149

def self.expo_push_token?(token)
  return false unless token

  /\AExpo(?:nent)?PushToken\[[^\]]+\]\z/.match?(token) ||
    /\A[a-z\d]{8}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{12}\z/i.match?(token)
end