Chat SDK for Unity and Windows v1.2.0
|
Public Member Functions | |
int | InitWithOptions (Options options) |
void | CreateAccount (string userId, string password, CallBack callback=null) |
void | Login (string userId, string pwdOrToken, bool isToken=false, CallBack callback=null) |
void | Logout (bool unbindDeviceToken=true, CallBack callback=null) |
void | LoginWithAgoraToken (string userId, string token, CallBack callback=null) |
void | RenewAgoraToken (string token) |
void | GetLoggedInDevicesFromServer (string userId, string password, ValueCallBack< List< DeviceInfo > > callback=null) |
void | GetLoggedInDevicesFromServerWithToken (string userId, string token, ValueCallBack< List< DeviceInfo > > callback=null) |
void | KickDevice (string userId, string password, string resource, CallBack callback=null) |
void | KickDeviceWithToken (string userId, string token, string resource, CallBack callback=null) |
void | KickAllDevices (string userId, string password, CallBack callback=null) |
void | KickAllDevicesWithToken (string userId, string token, CallBack callback=null) |
void | AddConnectionDelegate (IConnectionDelegate connectionDelegate) |
void | DeleteConnectionDelegate (IConnectionDelegate connectionDelegate) |
void | AddMultiDeviceDelegate (IMultiDeviceDelegate multiDeviceDelegate) |
void | DeleteMultiDeviceDelegate (IMultiDeviceDelegate multiDeviceDelegate) |
void | DeInit () |
Properties | |
static SDKClient | Instance [get] |
ChatManager | ChatManager [get] |
ContactManager | ContactManager [get] |
GroupManager | GroupManager [get] |
RoomManager | RoomManager [get] |
UserInfoManager | UserInfoManager [get] |
PresenceManager | PresenceManager [get] |
ChatThreadManager | ThreadManager [get] |
string | SdkVersion [get] |
string | CurrentUsername [get] |
bool | IsLoggedIn [get] |
bool | IsConnected [get] |
string | AccessToken [get] |
The SDK client class, the entry of the chat SDK, defines how to log in to and log out of the chat app and how to manage the connection between the SDK and the chat server.
int AgoraChat.SDKClient.InitWithOptions | ( | Options | options | ) |
Initializes the SDK.
Make sure that the SDK initialization is complete before you call any methods.
options | The options for SDK initialization. Ensure that you set the options. See Options . |
0
: Success;100
: The App key is invalid. void AgoraChat.SDKClient.CreateAccount | ( | string | userId, |
string | password, | ||
CallBack | callback = null |
||
) |
Creates a new user.
This method is not recommended and you are advised to call the RESTful API.
This is an asynchronous method.
userId | The user ID. Ensure that you set this parameter. |
The user ID can contain a maximum of 64 characters of the following types:
The user ID is case-insensitive, so Aa and aa are the same user ID.
The email address or the UUID of the user cannot be used as the user ID.
You can also set the user ID using a regular expression in the format of ^[a-zA-Z0-9_-]+$.
password | The password. The password can contain a maximum of 64 characters. Ensure that you set this parameter. |
callback | The creation result callback. See CallBack . |
void AgoraChat.SDKClient.Login | ( | string | userId, |
string | pwdOrToken, | ||
bool | isToken = false , |
||
CallBack | callback = null |
||
) |
Logs in to the chat server with a password or token.
This is an asynchronous method.
userId | The user ID. Ensure that you set this parameter. |
pwdOrToken | The password or token of the user. Ensure that you set this parameter. |
isToken | Whether to log in with a token or a password.
|
callback | The login result callback. See CallBack . |
void AgoraChat.SDKClient.Logout | ( | bool | unbindDeviceToken = true , |
CallBack | callback = null |
||
) |
Logs you out of the chat service.
This is an asynchronous method.
unbindToken | Whether to unbind the device with the token upon logout. This parameter is valid only for mobile platforms.
|
callback | The logout result callback. See CallBack . |
void AgoraChat.SDKClient.LoginWithAgoraToken | ( | string | userId, |
string | token, | ||
CallBack | callback = null |
||
) |
Logs in to the chat server with the user ID and an Agora token.
You can also log in to the chat server with the user ID and a password. See Login(string, string, bool, CallBack)
.
This an asynchronous method.
userId | The user ID. Ensure that you set this parameter. |
token | The Agora token. Ensure that you set this parameter. |
callback | The login result callback. See CallBack . |
void AgoraChat.SDKClient.RenewAgoraToken | ( | string | token | ) |
Renews the Agora token.
If you log in with an Agora token and are notified by a callback method IConnectionDelegate
that the token is to be expired, you can call this method to update the token to avoid unknown issues caused by an invalid token.
token | The new Agora token. |
void AgoraChat.SDKClient.GetLoggedInDevicesFromServer | ( | string | userId, |
string | password, | ||
ValueCallBack< List< DeviceInfo > > | callback = null |
||
) |
Gets the list of currently logged-in devices of a specified account.
This is an asynchronous method.
userId | The user ID. |
password | The password. |
callBack | The completion callback. If this call succeeds, calls ValueCallBack#OnSuccessValue(Object) to show device information list; if this call fails, calls ValueCallBack#onError(int, String) . |
void AgoraChat.SDKClient.GetLoggedInDevicesFromServerWithToken | ( | string | userId, |
string | token, | ||
ValueCallBack< List< DeviceInfo > > | callback = null |
||
) |
Gets the list of currently logged-in devices of a specified account.
This is an asynchronous method.
userId | The user ID. |
token | The token. |
callBack | The completion callback. If this call succeeds, calls ValueCallBack#OnSuccessValue(Object) to show device information list; if this call fails, calls ValueCallBack#onError(int, String) . |
void AgoraChat.SDKClient.KickDevice | ( | string | userId, |
string | password, | ||
string | resource, | ||
CallBack | callback = null |
||
) |
Forces the specified account to log out from the specified device.
You can call GetLoggedInDevicesFromServer()
to get the device information DeviceInfo
.
This is an asynchronous method.
userId | The user ID. |
password | The password. |
resource | The device ID. See DeviceInfo#Resource . |
void AgoraChat.SDKClient.KickDeviceWithToken | ( | string | userId, |
string | token, | ||
string | resource, | ||
CallBack | callback = null |
||
) |
Forces the specified account to log out from the specified device.
You can call GetLoggedInDevicesFromServer()
to get the device information DeviceInfo
.
This is an asynchronous method.
userId | The user ID. |
token | The token. |
resource | The device ID. See DeviceInfo#Resource . |
void AgoraChat.SDKClient.KickAllDevices | ( | string | userId, |
string | password, | ||
CallBack | callback = null |
||
) |
Forces the specified account to log out from all devices.
This is an asynchronous method.
userId | The user ID. |
password | The password. |
callback | The operation callback. See CallBack . |
void AgoraChat.SDKClient.KickAllDevicesWithToken | ( | string | userId, |
string | token, | ||
CallBack | callback = null |
||
) |
Forces the specified account to log out from all devices.
This is an asynchronous method.
userId | The user ID. |
token | The token. |
callback | The operation callback. See CallBack . |
void AgoraChat.SDKClient.AddConnectionDelegate | ( | IConnectionDelegate | connectionDelegate | ) |
Adds a connection status listener.
connectionDelegate | The connection status listener to add. It is inherited from IConnectionDelegate . |
void AgoraChat.SDKClient.DeleteConnectionDelegate | ( | IConnectionDelegate | connectionDelegate | ) |
Removes a connection status listener.
connectionDelegate | The connection status listener to remove. It is inherited from IConnectionDelegate . |
void AgoraChat.SDKClient.AddMultiDeviceDelegate | ( | IMultiDeviceDelegate | multiDeviceDelegate | ) |
Adds a connection listener.
multiDeviceDelegate | The multi-device listener to add. It is inherited from IMultiDeviceDelegate . |
void AgoraChat.SDKClient.DeleteMultiDeviceDelegate | ( | IMultiDeviceDelegate | multiDeviceDelegate | ) |
Removes a connection listener.
multiDeviceDelegate | The multi-device listener to remove. It is inherited from IMultiDeviceDelegate . |
|
get |
The chat manager instance.
|
get |
The contact manager instance.
|
get |
The group manager instance.
|
get |
The chat room manager instance.
|
get |
The user information manager instance.
|
get |
The presence manager instance.
|
get |
The thread manager instance.
|
get |
The SDK version.
|
get |
The ID of the current login user.
|
get |
Whether the current user is logged into the chat app.
true
: Yes.false
: No. The current user is not logged into the chat app yet.
|
get |
Whether the SDK is connected to the server.
true
: Yes.false
: No.
|
get |
The token of the current user.