Documentation ¶
Index ¶
- Constants
- func BuildRTCTokenWithUID(appID string, appCertificate string, channelName string, uid string, ...) (string, error)
- func BuildRTCTokenWithUserAccount(appID string, appCertificate string, channelName string, userAccount string, ...) (string, error)
- func BuildRTMToken(appID string, appCertificate string, userAccount string, ...) (string, error)
- type AccessToken
- type Privileges
- type RTCRole
Constants ¶
const AppIdLength = 32
const VersionLength = 3
Variables ¶
This section is empty.
Functions ¶
func BuildRTCTokenWithUID ¶
func BuildRTCTokenWithUID(appID string, appCertificate string, channelName string, uid string, role RTCRole, privilegeExpiredTs time.Time) (string, error)
BuildRTCTokenWithUID 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 BuildRTCTokenWithUserAccount ¶
func BuildRTCTokenWithUserAccount(appID string, appCertificate string, channelName string, userAccount string, role RTCRole, privilegeExpiredTs time.Time) (string, error)
BuildRTCTokenWithUserAccount 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)./
func BuildRTMToken ¶
func BuildRTMToken(appID string, appCertificate string, userAccount string, privilegeExpiredTs time.Time) (string, error)
BuildRTMToken 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.
userAccount: The user account. 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 {
// contains filtered or unexported fields
}
func NewAccessToken ¶
func NewAccessToken(appID, appCertificate, channelName string, uid uint32) *AccessToken
func NewAccessTokenFromString ¶
func NewAccessTokenFromString(originToken string) (*AccessToken, error)
func NewAccessTokenStrUID ¶
func NewAccessTokenStrUID(appID, appCertificate, channelName string, uid string) *AccessToken
func (*AccessToken) AddPrivilege ¶
func (token *AccessToken) AddPrivilege(privilege Privileges, expireTimestamp time.Time)
func (*AccessToken) Build ¶
func (token *AccessToken) Build() (string, error)
type Privileges ¶
type Privileges uint16
const ( PrivilegeJoinChannel Privileges = 1 PrivilegePublishAudioStream Privileges = 2 PrivilegePublishVideoStream Privileges = 3 PrivilegePublishDataStream Privileges = 4 PrivilegeAdministrateChannel Privileges = 101 PrivilegeLoginRtm Privileges = 1000 )