UNPKG

apns-send

Version:

The apns-send npm package enables seamless integration of push notifications using the Apple Push Notification service (APNs) with the HTTP/2 protocol.

78 lines (77 loc) 1.74 kB
/// <reference types="node" /> import { Secret } from 'jsonwebtoken'; import { Notification } from '../notifications/notification'; import { Http2Wrapper } from './http2-wrapper'; export declare enum Host { production = "api.push.apple.com", development = "api.sandbox.push.apple.com" } export interface SigningToken { value: string; timestamp: number; } export interface ApnsOptions { team: string; signingKey: Secret; keyId: string; defaultTopic?: string; host?: Host | string; requestTimeout?: number; pingInterval?: number; connections?: number; } export declare class ApnsClient extends Http2Wrapper { readonly team: string; readonly keyId: string; readonly host: Host | string; readonly signingKey: Secret; readonly defaultTopic?: string; private _token; private _emitter; constructor(options: ApnsOptions); send(notification: Notification): Promise<{ status: number; statusText: any; headers: import("http2").IncomingHttpHeaders; body: unknown; }>; sendMany(notifications: Notification[]): Promise<({ status: number; statusText: any; headers: import("http2").IncomingHttpHeaders; body: unknown; } | { error: any; })[]>; /** * * @param notification * @returns */ private _push; /** * * @param notification * @returns */ private _buildHeaders; /** * * @param deviceToken * @returns */ private _getPath; /** * * @returns */ private _getSigningToken; /** * */ private _handleEvents; /** * */ private _resetSigningToken; }