Skip to content

Commit

Permalink
fix(voip): Added support for passing options into VoipHeartbeatHandle…
Browse files Browse the repository at this point in the history
…r from the RealTimeContextFactory (#69)
  • Loading branch information
thzinc authored Nov 22, 2019
1 parent a4a8023 commit 3461c46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/resources/RealTimeContextFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/resources/VoipHeartbeatHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3461c46

Please sign in to comment.