AgoraIO / rtc-web-archive

Other
22 stars 29 forks source link

[bug] onTokenPrivilegeWillExipire is triggered only once time #9

Closed yukitaka13-1110 closed 4 years ago

yukitaka13-1110 commented 4 years ago

I use appCertificate in my project. After implement server side (token expired time -> 60s), I tried to retrieve token and renewToken. onTokenPrivilegeWillExipire triggered and I could success call renewToken with token that first time I generate, and continue to stream video. But second onTokenPrivilegeWillExipire event has not been fired. However, video streaming has continued all the time.

My server side code is the following.

function retrieveRtcToken(
  appId: string,
  appCertificate: string,
  uid: number,
  channelName: string
): string {
  const role = RtcRole.PUBLISHER;
  const expirationTimeInSeconds = 60;
  const currentTimestamp = Math.floor(Date.now() / 1000);
  const privilegeExpiredTs = currentTimestamp + expirationTimeInSeconds;
  return RtcTokenBuilder.buildTokenWithUid(
    appId,
    appCertificate,
    channelName,
    uid,
    role,
    privilegeExpiredTs
  );
}
yukitaka13-1110 commented 4 years ago

https://github.com/AgoraIO-Community/Agora-RTM-Nodejs/issues/15

plutoless commented 4 years ago

can you try putting the expire time a little bit longer? say 5 mins

peicodes commented 4 years ago

I'm having this issue as well. I set mine to 60 seconds.

The stream will continue working as if nothing's wrong. As soon as you make a change to your client (like ending your stream), it will throw a token expired error without any additional onTokenPrivilegeWillExpire or onTokenPrivilegeDidExpire events, and the token will no longer be usable.

5 minutes expire time does not work either.

plutoless commented 4 years ago

we confirmed this is current behavior and we are checking when SDK team can fix it.

yukitaka13-1110 commented 4 years ago

@plutoless Any updates from SDK team ?

plutoless commented 4 years ago

@yukitaka13-1110 we have an internal jira following on this issue. i think they are still working on the fix.

peicodes commented 4 years ago

@plutoless Could you share an update on that jira ticket?

plutoless commented 4 years ago

@peicodes i was told this issue has been fixed. could you pls help double check?

peicodes commented 4 years ago

@plutoless I just re-implemented a 60 second expiry, and it's working. Thanks for the fix!