sinch-rtc
Version:
RTC JavaScript/Web SDK
33 lines • 1.25 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CorrelationContext = void 0;
const utils_1 = require("../../utils");
class CorrelationContext {
constructor(userId, instanceId, callId) {
this.userId = userId;
this.instanceId = instanceId;
this.callId = callId;
}
Append(correlationContext, fieldName, fieldValue) {
if (correlationContext.length > 0) {
correlationContext = correlationContext.concat(",");
}
correlationContext = correlationContext.concat(fieldName, "=", fieldValue);
return correlationContext;
}
toHttpHeader() {
let correlationContext = "";
if (this.userId) {
correlationContext = this.Append(correlationContext, "userId", utils_1.Base64Helper.encode(this.userId));
}
if (this.instanceId) {
correlationContext = this.Append(correlationContext, "instanceId", this.instanceId);
}
if (this.callId) {
correlationContext = this.Append(correlationContext, "callId", this.callId);
}
return correlationContext;
}
}
exports.CorrelationContext = CorrelationContext;
//# sourceMappingURL=CorrelationContext.js.map