UNPKG

odyssey-spatial-comms

Version:

Drop-in replacement for Dolby/Voxeet SDK using Odyssey Spatial Audio Service

32 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NotificationAPI = void 0; const events_1 = require("events"); class NotificationAPI extends events_1.EventEmitter { constructor(apiClient) { super(); this.apiClient = apiClient; } async subscribe(subscriptions) { const socket = this.apiClient.getWebSocket(); if (!socket) { throw new Error('WebSocket not connected'); } subscriptions.forEach(sub => { socket.on(sub.type.toLowerCase().replace('.', ''), (data) => { this.emit(sub.type.toLowerCase().replace('.', ''), data); }); }); } async unsubscribe(subscriptions) { const socket = this.apiClient.getWebSocket(); if (!socket) { return; } subscriptions.forEach(sub => { socket.off(sub.type.toLowerCase().replace('.', '')); }); } } exports.NotificationAPI = NotificationAPI; //# sourceMappingURL=notification.js.map