(namespace: string, payload: PushPayload)
| 37 | } |
| 38 | |
| 39 | async sendToNamespace(namespace: string, payload: PushPayload): Promise<void> { |
| 40 | const subscriptions = this.store.push.getPushSubscriptionsByNamespace(namespace) |
| 41 | if (subscriptions.length === 0) { |
| 42 | return |
| 43 | } |
| 44 | |
| 45 | const body = JSON.stringify(payload) |
| 46 | await Promise.all(subscriptions.map((subscription) => { |
| 47 | return this.sendToSubscription(namespace, subscription, body) |
| 48 | })) |
| 49 | } |
| 50 | |
| 51 | private async sendToSubscription( |
| 52 | namespace: string, |
no test coverage detected