Documentation ¶
Index ¶
- Constants
- func BuildTokenWithUID(appID string, appCertificate string, channelName string, uid uint32, role Role, ...) (string, error)
- func BuildTokenWithUserAccount(appID string, appCertificate string, channelName string, userAccount string, ...) (string, error)
- type AccessToken
- type Privileges
- type Role
- type RtcTokenBuilder
Constants ¶
const ( KJoinChannel = 1 KPublishAudioStream = 2 KPublishVideoStream = 3 KPublishDataStream = 4 KPublishAudiocdn = 5 KPublishVideoCdn = 6 KRequestPublishAudioStream = 7 KRequestPublishVideoStream = 8 KRequestPublishDataStream = 9 KInvitePublishAudioStream = 10 KInvitePublishVideoStream = 11 KInvitePublishDataStream = 12 KAdministrateChannel = 101 KLoginRtm = 1000 )
const ( RoleAttendee = 0 RolePublisher = 1 RoleSubscriber = 2 RoleAdmin = 101 )
Role consts
const APP_ID_LENGTH = 32
const VERSION_LENGTH = 3
Variables ¶
This section is empty.
Functions ¶
func BuildTokenWithUID ¶
func BuildTokenWithUID(appID string, appCertificate string, channelName string, uid uint32, role Role, privilegeExpiredTs uint32) (string, error)
BuildTokenWithUID method appID: 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.
appCertificate: Certificate of the application that you registered in
the Agora Dashboard. See Get an App Certificate.
channelName:Unique channel name for the AgoraRTC session in the string format userAccount: The user account. role: Role_Publisher = 1: A broadcaster (host) in a live-broadcast profile.
Role_Subscriber = 2: (Default) A audience in a live-broadcast profile.
privilegeExpireTs: 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
func BuildTokenWithUserAccount ¶
func BuildTokenWithUserAccount(appID string, appCertificate string, channelName string, userAccount string, role Role, privilegeExpiredTs uint32) (string, error)
BuildTokenWithUserAccount method appID: 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.
appCertificate: Certificate of the application that you registered in
the Agora Dashboard. See Get an App Certificate.
channelName:Unique channel name for the AgoraRTC session in the string format uid: User ID. A 32-bit unsigned integer with a value ranging from
1 to (232-1). optionalUid must be unique.
role: Role_Publisher = 1: A broadcaster (host) in a live-broadcast profile.
Role_Subscriber = 2: (Default) A audience in a live-broadcast profile.
privilegeExpireTs: 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 timestamp + 600 (seconds)./
Types ¶
type AccessToken ¶
type AccessToken struct { AppID string AppCertificate string ChannelName string UidStr string Ts uint32 Salt uint32 Message map[uint16]uint32 Signature string CrcChannelName uint32 CrcUid uint32 MsgRawContent string }
func CreateAccessToken ¶
func CreateAccessToken(appID, appCertificate, channelName string, uid uint32) AccessToken
func CreateAccessToken2 ¶
func CreateAccessToken2(appID, appCertificate, channelName string, uid string) AccessToken
func (*AccessToken) AddPrivilege ¶
func (token *AccessToken) AddPrivilege(privilege Privileges, expireTimestamp uint32)
func (*AccessToken) Build ¶
func (token *AccessToken) Build() (string, error)
func (*AccessToken) FromString ¶
func (token *AccessToken) FromString(originToken string) bool
type Privileges ¶
type Privileges uint16