From 3461c46f27cb3334adb160011a0b5b75369002f0 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Fri, 22 Nov 2019 09:26:20 -0800 Subject: [PATCH] fix(voip): Added support for passing options into VoipHeartbeatHandler from the RealTimeContextFactory (#69) --- src/resources/RealTimeContextFactory.js | 5 +++-- src/resources/VoipHeartbeatHandler.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/resources/RealTimeContextFactory.js b/src/resources/RealTimeContextFactory.js index caefe30..dfa5917 100644 --- a/src/resources/RealTimeContextFactory.js +++ b/src/resources/RealTimeContextFactory.js @@ -161,10 +161,11 @@ class RealTimeContextFactory { /** * Creates a VoipHeartbeatHandler for sending current VOIP call state and receiving * desired VOIP call state over heartbeats. + * @param {Object} options Options for the handler * @returns {VoipHeartbeatHandler} The newly created handler. */ - voip() { - return new VoipHeartbeatHandler(this.realTimeClient, this.customerCode); + voip(options) { + return new VoipHeartbeatHandler(this.realTimeClient, this.customerCode, options); } } diff --git a/src/resources/VoipHeartbeatHandler.js b/src/resources/VoipHeartbeatHandler.js index 0c8a6f6..c20e35e 100644 --- a/src/resources/VoipHeartbeatHandler.js +++ b/src/resources/VoipHeartbeatHandler.js @@ -30,7 +30,21 @@ const getHeartbeat = (voipHeartbeatHandler) => { }; }; +/** + * Handler for VOIP call state and receiving desired VOIP call state over heartbeats. + */ class VoipHeartbeatHandler { + /** + * Creates a VoipHeartbeatHandler for sending current VOIP call state and receiving + * desired VOIP call state over heartbeats. + * @param {RealTimeClient} realTimeClient A pre-configured instance of RealTimeClient. + * @param {string} customerCode The customer code for this real-time context. + * @param {Object} options Options for the handler + * @param {number} [options.heartbeatIntervalMs] The minimum interval to send heartbeats to + * Track API + * @param {number} [options.heartbeatReadTimeoutMs] The time to wait for receiving a heartbeat + * from Track API + */ constructor(realTimeClient, customerCode, options = {}) { this.realTimeClient = realTimeClient; this.customerCode = customerCode;