@koi-design/callkit 2.2.0-beta.1 → 2.2.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -45,7 +45,7 @@ var Api = class {
45
45
  const res = await this.post({
46
46
  url: "/auth/agentUser/login",
47
47
  method: "post",
48
- data: params
48
+ data: { ...params, browserVersion: navigator.userAgent }
49
49
  });
50
50
  return res;
51
51
  } finally {
@@ -691,7 +691,7 @@ var Call = class {
691
691
  // package.json
692
692
  var package_default = {
693
693
  name: "@koi-design/callkit",
694
- version: "2.2.0-beta.1",
694
+ version: "2.2.0-beta.3",
695
695
  description: "callkit",
696
696
  author: "koi",
697
697
  license: "ISC",
@@ -16717,6 +16717,13 @@ var Socket = class {
16717
16717
  get reconnectConfig() {
16718
16718
  return this.callKit.config.getReconnectConfig("incall");
16719
16719
  }
16720
+ get pingInterval() {
16721
+ const { keepaliveInterval } = this.callKit.config.getConfig().userInfo;
16722
+ if (Number.isInteger(keepaliveInterval) && keepaliveInterval > 0) {
16723
+ return keepaliveInterval * 1e3;
16724
+ }
16725
+ return this.reconnectConfig.pingInterval;
16726
+ }
16720
16727
  isConnected() {
16721
16728
  return this.connectAuthState.isConnected;
16722
16729
  }
@@ -17051,8 +17058,8 @@ var Socket = class {
17051
17058
  return;
17052
17059
  this.send(SocketSendEvent.PING);
17053
17060
  const now = Date.now();
17054
- const { pingInterval, pingTimeout } = this.reconnectConfig;
17055
- if (now - this.lastPingTime > pingInterval + pingTimeout) {
17061
+ const { pingTimeout } = this.reconnectConfig;
17062
+ if (now - this.lastPingTime > this.pingInterval + pingTimeout) {
17056
17063
  this.callKit.logger.warn("Ping timeout not connected", {
17057
17064
  caller: "Socket.ping",
17058
17065
  type: "INCALL",
@@ -17070,10 +17077,9 @@ var Socket = class {
17070
17077
  if (this.pingTimer) {
17071
17078
  clearInterval(this.pingTimer);
17072
17079
  }
17073
- const { pingInterval } = this.reconnectConfig;
17074
17080
  this.pingTimer = setInterval(() => {
17075
17081
  this.ping();
17076
- }, pingInterval);
17082
+ }, this.pingInterval);
17077
17083
  }
17078
17084
  /**
17079
17085
  * reset socket connection and all states
@@ -17219,6 +17225,7 @@ var CallKit = class {
17219
17225
  content: {
17220
17226
  username,
17221
17227
  password,
17228
+ ua: navigator.userAgent,
17222
17229
  encryptionMethod,
17223
17230
  encryptionPassword
17224
17231
  }
@@ -17236,6 +17243,7 @@ var CallKit = class {
17236
17243
  password: encryptionPassword,
17237
17244
  timestamp: Date.now()
17238
17245
  });
17246
+ console.log("user", user);
17239
17247
  if (user) {
17240
17248
  this.config.setConfig("userInfo", {
17241
17249
  wsUrl: `wss://${user.wsUrl}`,
@@ -17252,6 +17260,7 @@ var CallKit = class {
17252
17260
  iceInfo: user.iceInfo,
17253
17261
  iceGatheringTimeout: user.iceGatheringTimeout,
17254
17262
  logGather: user.logGather,
17263
+ keepaliveInterval: user.keepaliveInterval,
17255
17264
  // encryptionType is in extra
17256
17265
  ...extra
17257
17266
  });