Class: AgoraDynamicKey::RTMTokenBuilder
- Inherits:
-
Object
- Object
- AgoraDynamicKey::RTMTokenBuilder
- Defined in:
- lib/dynamic_key/rtm_token_builder.rb
Defined Under Namespace
Modules: Role
Class Attribute Summary collapse
-
.token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
-
.build_token(payload) ⇒ Object
:app_id app_id The App ID issued to you by Agora.
Class Attribute Details
.token ⇒ Object
Returns the value of attribute token.
8 9 10 |
# File 'lib/dynamic_key/rtm_token_builder.rb', line 8 def token @token end |
Class Method Details
.build_token(payload) ⇒ Object
:app_id app_id The App ID issued to you by Agora. Apply for a new App ID from
Agora Dashboard if it is missing from your kit. See Get an App ID.
:app_certificate app_certificate Certificate of the application that you registered in
the Agora Dashboard. See Get an App Certificate.
:role role AgoraDynamicKey::RTCTokenBuilder::Role::RTM_USER = 1: RTM USER :account User Account. :privilege_expired_ts represented by the number of seconds elapsed since 1/1/1970.
If, for example, you want to access the Agora Service within 10 minutes
after the token is generated, set expireTimestamp as the current time stamp
+ 600 (seconds).
22 23 24 25 26 27 |
# File 'lib/dynamic_key/rtm_token_builder.rb', line 22 def build_token payload check! payload, %i[app_id app_certificate role account privilege_expired_ts] token = AccessToken.new @params.merge(:channel_name => @params[:account]) token.grant Privilege::RTM_LOGIN, @params[:privilege_expired_ts] token.build! end |