NIM C# SDK  6.3.0
NIM.ClientAPI Class Reference

NIM SDK提供的Client接口,主要包括SDK初始化/清理、客户端登录/退出/重连/掉线/被踢等流程 More...

Public Member Functions

delegate void KickOtherClientResultHandler (NIMKickOtherResult result)
 
delegate void MultiSpotLoginNotifyResultHandler (NIMMultiSpotLoginNotifyResult result)
 
delegate void KickoutResultHandler (NIMKickoutResult result)
 
delegate void LogoutResultDelegate (NIMLogoutResult result)
 
delegate void LoginResultDelegate (NIMLoginResult result)
 
delegate void DndConfigureDelegate (ResponseCode resCode, DndConfigParam config)
 

Static Public Member Functions

static bool Init (string appDataDir, string appInstallDir="", NimUtility.NimConfig config=null)
 NIM SDK初始化 More...
 
static bool Init (string appKey, string appDataDir, string appInstallDir="", NimUtility.NimConfig config=null)
 NIM SDK初始化 More...
 
static void RegisterSdkCallbacks ()
 注册全局回调函数,在切换账号都需要重新注册 More...
 
static void Cleanup ()
 NIM SDK清理 More...
 
static void CleanupEx ()
 
static void Login (string appKey, string account, string token, LoginResultDelegate handler=null)
 NIM客户端登录 More...
 
static void Relogin (string jsonExtension=null)
 NIM客户端手动重连(注意 APP需要统一处理自动重连/手动重连的回调,因为如果处于某次自动重连的过程中调用手动重连接口,不起作用!) . More...
 
static void Logout (NIMLogoutType logoutType, LogoutResultDelegate @delegate)
 NIM客户端注销/退出,异步方法,回调函数中报告执行结果 More...
 
static void Logout (NIMLogoutType logoutType, int waitSeconds=10)
 NIM客户端注销/退出,同步方法 More...
 
static void KickOtherClients (NIMKickoutOtherDeviceInfo devices)
 将本帐号的其他端踢下线.通过注册RegKickOtherClientCb回调得到结果 More...
 
static void RegAutoReloginCb (LoginResultDelegate handler, string jsonExtension=null)
 注册NIM客户端自动重连回调。重连失败时,如果不是网络错误引起的(网络相关的错误号为kNIMResTimeoutError和kNIMResConnectionError),而是服务器返回了非kNIMResSuccess的错误号, 则说明重连的机制已经失效,需要APP层调用Logout执行注销操作并退回到登录界面后进行重新登录. More...
 
static void RegKickoutCb (KickoutResultHandler handler)
 注册NIM客户端被踢回调. More...
 
static void RegDisconnectedCb (Action handler)
 注册NIM客户端掉线回调. More...
 
static void RegMultiSpotLoginNotifyCb (MultiSpotLoginNotifyResultHandler handler)
 注册NIM客户端多点登录通知回调. More...
 
static void RegKickOtherClientCb (KickOtherClientResultHandler handler)
 注册NIM客户端将本帐号的其他端踢下线结果回调. More...
 
static void EnableMultiportPush (ConfigMultiportPushDelegate cb)
 开启多端推送 More...
 
static void DisableMultiportPush (ConfigMultiportPushDelegate cb)
 禁止多端推送 More...
 
static void IsMultiportPushEnabled (ConfigMultiportPushDelegate cb)
 获取多端推送控制开关 More...
 
static void RegMulitiportPushEnableChangedCb (ConfigMultiportPushDelegate cb)
 注册多端推送设置同步回调 More...
 
static void UpdateApnsToken (string token)
 更新ios推送token More...
 
static void SetDndConfig (DndConfigParam param, DndConfigureDelegate cb)
 ios 免打扰设置 More...
 
static void GetDndConfig (DndConfigureDelegate cb)
 获取ios 免打扰设置 More...
 
static NIMLoginState GetLoginState (string jsonExt=null)
 获取NIM客户端登录状态 More...
 
static string GetVersion ()
 获取NIM SDK 版本号 More...
 

Static Public Attributes

static EventHandler< LoginResultEventArgsLoginResultHandler
 

Properties

static bool SdkInitialized [get]
 SDK是否已经初始化 More...
 

Detailed Description

NIM SDK提供的Client接口,主要包括SDK初始化/清理、客户端登录/退出/重连/掉线/被踢等流程

Member Function Documentation

◆ Cleanup()

static void NIM.ClientAPI.Cleanup ( )
static

NIM SDK清理

◆ CleanupEx()

static void NIM.ClientAPI.CleanupEx ( )
static

◆ DisableMultiportPush()

static void NIM.ClientAPI.DisableMultiportPush ( ConfigMultiportPushDelegate  cb)
static

禁止多端推送

Parameters
cb操作结果委托

◆ DndConfigureDelegate()

delegate void NIM.ClientAPI.DndConfigureDelegate ( ResponseCode  resCode,
DndConfigParam  config 
)

◆ EnableMultiportPush()

static void NIM.ClientAPI.EnableMultiportPush ( ConfigMultiportPushDelegate  cb)
static

开启多端推送

Parameters
cb操作结果委托

◆ GetDndConfig()

static void NIM.ClientAPI.GetDndConfig ( DndConfigureDelegate  cb)
static

获取ios 免打扰设置

Parameters
cb

◆ GetLoginState()

static NIMLoginState NIM.ClientAPI.GetLoginState ( string  jsonExt = null)
static

获取NIM客户端登录状态

Parameters
jsonExt
Returns

◆ GetVersion()

static string NIM.ClientAPI.GetVersion ( )
static

获取NIM SDK 版本号

Returns

◆ Init() [1/2]

static bool NIM.ClientAPI.Init ( string  appDataDir,
string  appInstallDir = "",
NimUtility.NimConfig  config = null 
)
static

NIM SDK初始化

Parameters
appDataDir使用默认路径时只需传入单个目录名(不以反斜杠结尾),使用自定义路径时需传入完整路径(以反斜杠结尾,并确保有正确的读写权限!).
appInstallDir目前不需要传入(SDK可以自动获取).
configThe config.
Returns
true 成功, false 失败

◆ Init() [2/2]

static bool NIM.ClientAPI.Init ( string  appKey,
string  appDataDir,
string  appInstallDir = "",
NimUtility.NimConfig  config = null 
)
static

NIM SDK初始化

Parameters
appKeyAppKey,必填
appDataDir使用默认路径时只需传入单个目录名(不以反斜杠结尾),使用自定义路径时需传入完整路径(以反斜杠结尾,并确保有正确的读写权限!).
appInstallDir目前不需要传入(SDK可以自动获取).
configThe config.
Returns
true 成功, false 失败

◆ IsMultiportPushEnabled()

static void NIM.ClientAPI.IsMultiportPushEnabled ( ConfigMultiportPushDelegate  cb)
static

获取多端推送控制开关

Parameters
cb

◆ KickOtherClientResultHandler()

delegate void NIM.ClientAPI.KickOtherClientResultHandler ( NIMKickOtherResult  result)

◆ KickOtherClients()

static void NIM.ClientAPI.KickOtherClients ( NIMKickoutOtherDeviceInfo  devices)
static

将本帐号的其他端踢下线.通过注册RegKickOtherClientCb回调得到结果

Parameters
devices设备标识

◆ KickoutResultHandler()

delegate void NIM.ClientAPI.KickoutResultHandler ( NIMKickoutResult  result)

◆ Login()

static void NIM.ClientAPI.Login ( string  appKey,
string  account,
string  token,
LoginResultDelegate  handler = null 
)
static

NIM客户端登录

Parameters
appKeyThe app key.
accountThe account.
token令牌 (在后台绑定的登录token).
handler登录流程的回调函数

◆ LoginResultDelegate()

delegate void NIM.ClientAPI.LoginResultDelegate ( NIMLoginResult  result)

◆ Logout() [1/2]

static void NIM.ClientAPI.Logout ( NIMLogoutType  logoutType,
LogoutResultDelegate delegate 
)
static

NIM客户端注销/退出,异步方法,回调函数中报告执行结果

Parameters
logoutTypeLogout操作类型
delegate注销/退出的回调函数.

◆ Logout() [2/2]

static void NIM.ClientAPI.Logout ( NIMLogoutType  logoutType,
int  waitSeconds = 10 
)
static

NIM客户端注销/退出,同步方法

Parameters
logoutType
waitSeconds

◆ LogoutResultDelegate()

delegate void NIM.ClientAPI.LogoutResultDelegate ( NIMLogoutResult  result)

◆ MultiSpotLoginNotifyResultHandler()

delegate void NIM.ClientAPI.MultiSpotLoginNotifyResultHandler ( NIMMultiSpotLoginNotifyResult  result)

◆ RegAutoReloginCb()

static void NIM.ClientAPI.RegAutoReloginCb ( LoginResultDelegate  handler,
string  jsonExtension = null 
)
static

注册NIM客户端自动重连回调。重连失败时,如果不是网络错误引起的(网络相关的错误号为kNIMResTimeoutError和kNIMResConnectionError),而是服务器返回了非kNIMResSuccess的错误号, 则说明重连的机制已经失效,需要APP层调用Logout执行注销操作并退回到登录界面后进行重新登录.

Parameters
jsonExtensionjson扩展参数(备用,目前不需要)
handler自动重连的回调函数 如果返回错误号kNIMResExist,说明无法继续重连,App层必须调用Logout退出到登录界面,以便用户重新进行登录.

◆ RegDisconnectedCb()

static void NIM.ClientAPI.RegDisconnectedCb ( Action  handler)
static

注册NIM客户端掉线回调.

Parameters
handler掉线的回调函数.

◆ RegisterSdkCallbacks()

static void NIM.ClientAPI.RegisterSdkCallbacks ( )
static

注册全局回调函数,在切换账号都需要重新注册

◆ RegKickOtherClientCb()

static void NIM.ClientAPI.RegKickOtherClientCb ( KickOtherClientResultHandler  handler)
static

注册NIM客户端将本帐号的其他端踢下线结果回调.

Parameters
handler操作结果的回调函数.

◆ RegKickoutCb()

static void NIM.ClientAPI.RegKickoutCb ( KickoutResultHandler  handler)
static

注册NIM客户端被踢回调.

Parameters
handler被踢回调

◆ RegMulitiportPushEnableChangedCb()

static void NIM.ClientAPI.RegMulitiportPushEnableChangedCb ( ConfigMultiportPushDelegate  cb)
static

注册多端推送设置同步回调

Parameters
cb

◆ RegMultiSpotLoginNotifyCb()

static void NIM.ClientAPI.RegMultiSpotLoginNotifyCb ( MultiSpotLoginNotifyResultHandler  handler)
static

注册NIM客户端多点登录通知回调.

Parameters
handler多点登录通知的回调函数.

◆ Relogin()

static void NIM.ClientAPI.Relogin ( string  jsonExtension = null)
static

NIM客户端手动重连(注意 APP需要统一处理自动重连/手动重连的回调,因为如果处于某次自动重连的过程中调用手动重连接口,不起作用!) .

Parameters
jsonExtensionjson扩展参数(备用,目前不需要).

◆ SetDndConfig()

static void NIM.ClientAPI.SetDndConfig ( DndConfigParam  param,
DndConfigureDelegate  cb 
)
static

ios 免打扰设置

Parameters
param
cb

◆ UpdateApnsToken()

static void NIM.ClientAPI.UpdateApnsToken ( string  token)
static

更新ios推送token

Parameters
token

Member Data Documentation

◆ LoginResultHandler

EventHandler<LoginResultEventArgs> NIM.ClientAPI.LoginResultHandler
static

Property Documentation

◆ SdkInitialized

bool NIM.ClientAPI.SdkInitialized
staticget

SDK是否已经初始化