@defcomm/meetingsdk 0.7.1 → 0.7.2

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/README.md CHANGED
@@ -92,6 +92,7 @@ Your backend
92
92
  Do **not** put a server-only API secret in browser code. Your backend should handle server credentials and issue the short-lived/access-scoped token that the browser uses for the meeting.
93
93
 
94
94
  Your application is responsible for deciding who the participant is and for obtaining the token securely.
95
+ The SDK uses the supplied `config.token` for REST and SFU authentication. It does not request or refresh tokens; reconnects reuse the same token.
95
96
 
96
97
  ---
97
98
 
package/dist/index.js CHANGED
@@ -504,9 +504,9 @@ var SFUClient = class {
504
504
  this.publisherRevision = 0;
505
505
  this.screenShareGeneration = 0;
506
506
  this.currentParticipantId = null;
507
- // Provider/application token used for authenticated REST calls.
507
+ // Token supplied by the application for REST and SFU authentication.
508
508
  this.authToken = null;
509
- // Room/SFU token returned by /token and used for the WebSocket.
509
+ // Token used for the current WebSocket session.
510
510
  this.token = null;
511
511
  this.room = null;
512
512
  this.resumeToken = null;
@@ -797,7 +797,8 @@ var SFUClient = class {
797
797
  }
798
798
  );
799
799
  }
800
- async getToken(roomCode, options = {}) {
800
+ async join(roomCode, options = {}) {
801
+ if (!this.authToken) throw new Error("Authentication token is required");
801
802
  const nextRoom = roomCode.trim();
802
803
  if (this.room && this.room !== nextRoom) {
803
804
  this.resumeToken = null;
@@ -815,33 +816,7 @@ var SFUClient = class {
815
816
  if (!this.resumeToken) {
816
817
  this.resumeToken = this.loadResumeToken(this.room);
817
818
  }
818
- const data = await this.request(`${this.apiBase}/token`, {
819
- method: "POST",
820
- body: JSON.stringify({
821
- room_code: this.room,
822
- user_id: this.participantId,
823
- display_name: options.displayName,
824
- avatar_url: options.avatarUrl
825
- })
826
- });
827
- this.token = data?.token;
828
- if (!this.token) throw new Error("Token endpoint returned no token");
829
- return this.connect(this.token, this.joinOptions);
830
- }
831
- async refreshAccessToken() {
832
- if (!this.room) throw new Error("Cannot refresh token without a room");
833
- const data = await this.request(`${this.apiBase}/token`, {
834
- method: "POST",
835
- body: JSON.stringify({
836
- room_code: this.room,
837
- user_id: this.participantId,
838
- display_name: this.joinOptions.displayName,
839
- avatar_url: this.joinOptions.avatarUrl
840
- })
841
- });
842
- if (!data?.token) throw new Error("Token refresh returned no token");
843
- this.token = data.token;
844
- return this.token;
819
+ return this.connect(this.authToken, this.joinOptions);
845
820
  }
846
821
  connect(token, options = {}) {
847
822
  this.token = token;
@@ -931,15 +906,9 @@ var SFUClient = class {
931
906
  this.reconnectBaseMs * Math.pow(2, this.reconnectAttempt - 1)
932
907
  );
933
908
  this.onReconnecting(this.reconnectAttempt);
934
- this.reconnectTimer = setTimeout(async () => {
909
+ this.reconnectTimer = setTimeout(() => {
935
910
  this.reconnectTimer = null;
936
- try {
937
- await this.refreshAccessToken();
938
- this.openWebSocket(this.joinOptions);
939
- } catch (error) {
940
- this.onError(error);
941
- this.scheduleReconnect();
942
- }
911
+ this.openWebSocket(this.joinOptions);
943
912
  }, delay);
944
913
  }
945
914
  failJoin(error) {
@@ -2714,7 +2683,7 @@ var VideoSDKCore = class {
2714
2683
  );
2715
2684
  }
2716
2685
  this.sfuClient.setLocalStream(this.localStream);
2717
- await this.sfuClient.getToken(roomId, {
2686
+ await this.sfuClient.join(roomId, {
2718
2687
  displayName: name,
2719
2688
  participantId: this.myId,
2720
2689
  audioMuted: !(this.localStream?.getAudioTracks()[0]?.enabled ?? false),