MCPcopy Create free account
hub / github.com/node-apn/node-apn / Client

Function Client

lib/client.js:10–38  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

8 const EndpointManager = dependencies.EndpointManager;
9
10 function Client (options) {
11 this.config = config(options);
12
13 this.endpointManager = new EndpointManager(this.config);
14 this.endpointManager.on("wakeup", () => {
15 while (this.queue.length > 0) {
16 const stream = this.endpointManager.getStream();
17 if (!stream) {
18 return;
19 }
20 const resolve = this.queue.shift();
21 resolve(stream);
22 }
23
24 if (this.shutdownPending) {
25 this.endpointManager.shutdown();
26 }
27 });
28
29 this.endpointManager.on("error", (err) => {
30 this.queue.forEach((resolve) => {
31 resolve(Promise.reject(err));
32 });
33
34 this.queue = [];
35 });
36
37 this.queue = [];
38 }
39
40 Client.prototype.write = function write (notification, device, count) {
41 return this.getStream().then( stream => {

Callers

nothing calls this directly

Calls 1

configFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…