Initialization
Update time: 2021/12/03 17:38:57
Initialization
Preparation: Put the SDK related dll files (nim.dll, nim_audio.dll, nim_tools_http.dll, nrtc.dll) into the App's running directory. The SDK is developed based on vs2017+vs2013. If the app does not have a corresponding runtime library file, please put into the App's run directory the dynamic library in the folder redist_packages as well as msvcp120.dll and msvcr120.dll.
When the program is started after finishing the preparation, using the C interface requires calling LoadLibrary feature to dynamically load nim.dll, then calling GetProcAddress to get the API interface: nim_client_init, which can be called to initialize NIM SDK. At the same time, parameters of the SDK capabilities are passed in when initializing the SDK, as well as the address of a independently deployed server (if needed).
API overview
-
C++
static bool Init (const std::string &app_key, const std::string &app_data_dir, const std::string &app_install_dir, const SDKConfig &config)
File:nim_cpp_client.h
Namespace:NIM
Class:Client
-
C#
static bool Init (string appDataDir, string appInstallDir="", NimUtility.NimConfig config=null)
Namespace:NIM
Class:ClientAPI
-
C
NIM_SDK_DLL_API bool nim_client_init (const char *app_data_dir, const char *app_install_dir, const char *json_extension)
File:nim_client.h
Parameter Description
- C/C++
Parameter | Type | Required | Description |
---|---|---|---|
app_key(C++) | std::string | Yes | Use the registered CommsEase app KEY |
app_data_dir | std::string | Yes | Input only the directory name (not ending with a backslash) when using the default path, but when using a custom path, the full path is required to be input (make sure it ends with a backslash , and has the correct read and write permissions!) |
app_install_dir | std::string | No | The full path of the directory that contains the SDK dynamic library (if the input is empty, then search for the dynamic library based on the default rules) |
config(C++) | struct | No | Initialize special parameters (explained below) |
json_extension(C) | std::string | No | Initialize special parameters (explained below) |
- C#
Parameter | Type | Required | Description |
---|---|---|---|
appDataDir | std::string | Yes | Input only the directory name (not ending with a backslash) when using the default path, but when using a custom path, the full path is required to be input (make sure it ends with a backslash , and has the correct read and write permissions!) |
appInstallDir | std::string | No | The full path of the directory that contains the SDK dynamic library (if the input is empty, then search for the dynamic library based on the default rules) |
config | struct | No | Initialize special parameters (explained below) |
Instructions for initializing special parameters
Developers can set special parameters by configuring SDKConfig(C++)/NIMConfig(C#)/json_extenstion(C) during initialization.
- C++
SDKConfig parameters | Type | Description |
---|---|---|
database_encrypt_key_ | std::string | Encryption key for database. This is a required field as recommended, with a maximum length up to 32 characters! 32 characters are recommended |
custom_timeout_ | int | Custom communication timeout, currently not available |
login_max_retry_times_ | int | The maximum number of login retries. It is recommended to set the value as greater than 3. SDK sets the value by default |
preload_attach_ | bool | Whether to pre-load attachments (image and voice) , optional, true by default, set to false is recommended in case of high requirement on bandwidth traffic, allowing upper-level developer to download attachments as required |
preload_image_quality_ | int | Quality of pre-loaded image, optional, value range is 0-100 |
preload_image_resize_ | std::string | Resizing the pre-loaded image, optional. For example 100x50 indicates width x height. |
preload_image_name_template | std::string | Naming rule for IM message attachment (with image, video cover) thumbnails, replacing with {filename} as the token |
sdk_log_level_ | enum | SDK log level, see NIMSDKLogLevel for definition, optional, the default built-in level is kNIMSDKLogLevelPro |
sync_session_ack_ | bool | Whether the read and unread status is synchronized with multiple clients, true by default |
reset_unread_count_when_recall | bool | Whether to recalculate the unread count after a message is recalled, false by default |
use_https | bool | Whether to enable HTTPS protocol, true by default |
use_private_server_ | bool | [Discarded after v 7.0.0] Whether to use a private server, if yes, it must be set as true |
default_link_address_ | std::string | Default link server address, required if a private server is used |
default_link_address_ipv6_ | std::string | Default link ipv6 server address, ip_protocol_version_ == 1 (ipv6) is required if a private server is used |
default_nos_access_address_ | std::string | Default nos access address, required if a private server is used |
default_nos_download_address_ | std::string | Default nos download address, required if a private server is used |
default_nos_upload_address_ | std::string | Default nos upload address, required if a private server is used |
lbs_address_ | std::string | Default lbs address, required if a private server is used |
nos_lbs_address_ | std::string | Default nos lbs address, required if a private server is used |
rsa_public_key_module_ | std::string | RSA public key, required if a private server is used [Discarded after v6.9.0] |
rsa_version_ | int | RSA version, required if a private server is used [Discarded after v6.9.0] |
private_enable_https_ | bool | Whether to enable HTTPS protocol for privatization configuration, if so use_https_ will be overwritten, default_nos_upload_host_ is required when it is set to true |
nos_download_address_list_ | std::string | Splicing template for nos download address, used for piecing together the final download address |
nos_accelerate_host_ | std::string | Name of the host that requires acceleration [not recommended for v8.1.0 and later versions, nos_accelerate_host_list_ is recommended] |
nos_accelerate_host_list_ | std::vector< std::string > | Name list of hosts requiring acceleration |
nos_accelerate_address_ | std::string | Splicing template for nos acceleration address, used for getting the address for accelerated download |
vchat_miss_unread_count_ | bool | Whether to include missed voice messages in unread count, false by default |
caching_markread_enabled | bool | Whether SDK can send "Receipt obtained" to the server in batches, recommended if app receives so many messages as to trigger rate limit, false by default |
caching_markread_time | int | Valid when caching_markread_enabled == true, caching time, 1000ms by default |
caching_markread_count | int | Valid when caching_markread_enabled == true, maximum number of cached messages, default is 10 |
enable_user_datafile_backup | bool | Whether to enable (local) backup of user data, true by default |
enable_user_datafile_restore | bool | Whether to enable (local) recovery of user data, false by default |
enable_user_datafile_defrestoreproc | bool | Whether to use the default (local) user data recovery solution, default is false, valid when enable_user_datafile_restore == true |
user_datafile_localbackup_folder | std::string | Directory for (local) user data file backup, read and write permissions required, by default, the db_file.back directory is created under the directory where the data file is located |
upload_sdk_events_after_login_ | bool | After calling the Login interface (no matter whether it is successful or not), report the error log history to the server (408, 415, 500 supported currently), false by default |
ip_protocol_version_ | int | IP address family settings 0:ipv4 1:ipv6 2:auto, choose one option after passing SDK test, minor performance loss expected Default is 0 (ipv4) |
probe_ipv4_url_ | std::string | url for detecting ipv6address type, valid when ip_protocol_version_ == 2(auto) |
probe_ipv6_url_ | std::string | url for detecting ipv6address type, valid when ip_protocol_version_ == 2(auto) |
hand_shake_type_ | int | The type of handshake protocol used for login, 0: a combination of multiple symmetric and asymmetric encryption algorithms, 1: only RAS + RC4, default is 1 |
nego_key_neca_ | int | The encryption algorithm of "exchange key" protocol {1(RSA),2(SM2)}, def:1(RSA) asymmetric encryption |
nego_key_neca_key_parta_ | std::string | The encryption algorithm of "exchange key" protocol, required for custom part A, BigNumHex string does not contain 0x RSA:module,SM2:X |
nego_key_neca_key_partb_ | std::string | Asymmetric encryption algorithm key2 RSA:EXP,SM2: Required for custom SM2Y |
nego_key_neca_key_version_ | int | Required for custom key version of asymmetric encryption algorithm |
comm_neca_ | int | Communication encryption algorithm {1(RC4),2(AES128),4(SM4)} def:1(RC4) symmetric encryption |
dedicated_cluste_flag_ | bool | Dedicated cluster or not {true,false} def:false |
priority_use_cdn_host_ | bool | Whether to preferentially use cdn domain name (valid after v8.1.0) {true,false} def:true |
cache_session_data_when_delete_ | bool | Whether to cache the original session data in the database when deleting the session (valid after v8.3.5) {true,false} def:false |
- C#
NIMConfig parameters | Type | Description |
---|---|---|
AppKey | std::string | Use the registered CommsEase app KEY |
CommonSetting.DataBaseEncryptKey | std::string | Encryption key for database. This is a required field as recommended, with a maximum length up to 32 characters! 32 characters are recommended |
CommonSetting.PredownloadAttachmentThumbnail | bool | Whether to pre-load attachments (image and voice) , optional, true by default, set to false is recommended in case of high requirement on bandwidth traffic, allowing upper-level developer to download attachments as required |
CommonSetting.LogLevel | enum | SDK log level, see NIMSDKLogLevel for definition, optional, the default built-in level is kNIMSDKLogLevelPro |
CommonSetting.UsePriviteServer | bool | Whether to use a private server, if so then it must be set to true |
SdkPrivateServerSetting.LinkServerList | std::list< std::string> | Default link server address, required if a private server is used |
SdkPrivateServerSetting.AccessServerList | std::list< std::string> | Default nos access address,required if a private server is used |
SdkPrivateServerSetting.DownloadServerList | std::list< std::string> | Default nos download address,required if a private server is used |
SdkPrivateServerSetting.UploadServerList | std::list< std::string> | Default nos upload address,required if a private server is used |
SdkPrivateServerSetting.LbsAddress | std::string | Default lbs address, required if a private server is used |
SdkPrivateServerSetting.NOSLbsAddress | std::string | Default nos lbs address, required if a private server is used |
SdkPrivateServerSetting.RSAPublicKey | std::string | RSA public key, required if a private server is used |
SdkPrivateServerSetting.RsaVersion | int | RSA version, required if a private server is used |
-
C
In the C interface, special parameters are input to SDK as a string (json_extension) that is serialized from a group of managed and configured json data structures, The definition of the key is in the header file nim_client_def.h.
Key constant name | Key constant value | Value type | Description |
---|---|---|---|
kNIMAppKey | app_key | std::string | Use the registered CommsEase app KEY |
kNIMGlobalConfig | global_config | json object | Global configuration, the following ordinary configurations are all its sub-objects |
kNIMDataBaseEncryptKey | db_encrypt_key | std::string | One of the ordinary configurations, encryption key for database, highly recommended to fill out, length currently limited to no more than 32 characters! 32 characters are recommended |
kNIMLoginRetryMaxTimes | login_max_retry_times | int | One of the ordinary configurations, the maximum number of login retries. It is recommended to set the value as greater than 3. The value is set by default for SDK |
kNIMPreloadAttach | preload_attach | bool | One of the ordinary configurations, whether to pre-load attachments (image and audio), optional, true by default, set to false is recommended in case of high requirement on bandwidth traffic, allowing upper-level developer to download attachments as required |
kNIMPreloadImageQuality | preload_image_quality | int | One of the ordinary configurations, quality of pre-loaded image, optional, value range is 0-100 |
kNIMPreloadImageResize | preload_image_resize | std::string | One of the ordinary configurations, resizing the pre-loaded image, optional. For example, 100x50 indicates width x height. |
kPreloadAttachImageNameTemplate | preload_image_name_template | std::string | Naming rule for IM message attachment (with image, video cover) thumbnails, replacing with {filename} as the token |
kNIMSDKLogLevel | sdk_log_level | enum | One of the ordinary configurations, SDK log level, see NIMSDKLogLevel for definition, optional, the default built-in level is kNIMSDKLogLevelPro |
kNIMSyncSessionAck | sync_session_ack | bool | One of the ordinary configurations, whether the read and unread status is synchronized with multiple clients, true by default |
kNIMResetUnreadCountWhenRecall | reset_unread_count_when_recall | bool | Whether to recalculate the unread count after a message is recalled, false by default |
kNIMUseHttps | use_https | bool | Whether to enable HTTPS protocol, true by default, If a private server is in use with https enabled, then nos_uploader_host needs to be configured for privatization |
kNIMPrivateServerSetting | private_server_setting | json object | [Discarded after v7.0.0, with kNIMUseHttps used for all configurations] Private server configuration, the following commonly used private server configurations are all its sub-objects |
kNIMDefaultLinkAddress | link | json string array | One of the private server configurations, default link server address, required if a private server is used |
kNIMDefaultLinkAddressIPV6 | link_ipv6 | json string array | Default link ipv6 server address, kNIMIPProtVersion == 1 (ipv6) is required |
kNIMDefaultNosAccessAddress | default_nos_access | json string array | One of the private server configurations, default nos access server address, required if a private server is used |
kNIMDefaultNosDownloadAddress | default_nos_download | json string array | One of the private server configurations, default nos server address, required if a private server is used |
kNIMDefaultNosUploadAddress | default_nos_upload | json string array | One of the private server configurations, default nos upload server address, required if a private server is used |
kNIMLbsAddress | lbs | std::string | One of the private server configurations, lbs address,required if a private server is used |
kNIMNosLbsAddress | nos_lbs | std::string | One of the private server configurations, nos lbs address,required if a private server is used |
kNIMRsaPublicKeyModule | rsa_public_key_module | std::string | [Discarded after v6.9.0] One of the private server configurations, RSA public key,required if a private server is used |
kNIMRsaVersion | rsa_version | int | [Discarded after v6.9.0] One of the private server configurations, RSA version,required if a private server is used |
kNIMDownloadAddressTemplate | download_address_template | json string array | Splicing template for nos download address, used for piecing together the final download address |
kNIMAccelerateHost | accelerate_host | json string | Name of the host that requires acceleration [not recommended for v8.1.0 and later versions, kMINAccelerateHostListis recommended] |
kMINAccelerateHostList | nos_accelerate_host_list | json string array | Name list of hosts requiring acceleration |
kNIMAccelerateAddressTemplate | accelerate_address_template | json string array | Splicing template for nos acceleration address, used for getting the address for accelerated download |
kCachingMarkreadEnabled | caching_markread_enabled | bool | Whether SDK can send "Receipt obtained" to the server in batches, recommended if app receives so many messages as to trigger rate limit, false by default |
kCachingMarkreadTime | caching_markread_time | int | Valid when caching_markread_enabled == true, caching time, 1000ms by default |
kCachingMarkreadCount | caching_markread_count | int | Valid when caching_markread_enabled == true, maximum number of cached messages, default is 10 |
kEnableUserDataFileLocalBackup | enable_user_datafile_backup | bool | Whether to enable (local) backup of user data, true by default |
kEnableUserDataFileLocalRestore | enable_user_datafile_restore | bool | Whether to enable (local) recovery of user data, false by default |
kEnableUserDataFileDefRestoreProc | enable_user_datafile_defrestoreproc | bool | Whether to use the default (local) user data recovery solution, default is false, valid when enable_user_datafile_restore == true |
kUserDataFileLocalBackupFolder | user_datafile_localbackup_folder | std::string | Directory for (local) user data file backup, read and write permissions required, by default, the db_file.back directory is created under the directory where the data file is located |
kNIMUploadSDKEventsAfterLogin | upload_sdk_events_after_login | bool | After calling the Login interface (no matter whether it is successful or not), report the error log history to the server (408, 415, 500 supported currently), false by default |
kNIMIPProtVersion | ip_protocol_version | int | IP address family settings 0:ipv4 1:ipv6 2:auto, choose one option after passing SDK test, minor performance loss expected Default is 0 (ipv4) |
kNIMProbeIPV4URL | probe_ipv4_url | string | url for detecting ipv6address type, valid when ip_protocol_version_ == 2(auto) |
kNIMProbeIPV6URL | probe_ipv6_url | string | url for detecting ipv6address type, valid when ip_protocol_version_ == 2(auto) |
kNIMHandShakeType | hand_shake_type | int | The type of handshake protocol used for login, 0: a combination of multiple symmetric and asymmetric encryption algorithms, 1: only RAS + RC4, default is 1 |
kNIMNegoKeyNECA | nego_key_neca | int | The encryption algorithm of "exchange key" protocol {1(RSA),2(SM2)}, def:1(RSA) asymmetric encryption |
kNIMNegoKeyNECAKeyPA | nego_key_neca_key_parta | string | The encryption algorithm of "exchange key" protocol, required for custom part A, BigNumHex string does not contain 0x RSA:module,SM2:X |
kNIMNegoKeyNECAKeyPB | nego_key_neca_key_partb | string | Asymmetric encryption algorithm key2 RSA:EXP,SM2: Required for custom SM2Y |
kNIMNegoKeyNECAKeyV | nego_key_neca_key_version | int | Required for custom key version of asymmetric encryption algorithm |
kNIMCommNECA | comm_neca | int | Communication encryption algorithm {1(RC4),2(AES128),4(SM4)} def:1(RC4) symmetric encryption |
kNIMDedicatedClusteFlag | dedicated_cluste_flag | bool | Dedicated cluster or not {true,false} def:false |
kPriorityUseCdnHost | priority_use_cdn_host | bool | Whether to preferentially use cdn domain name {true,false} def:true |
kNIMCacheSessionDataWhenDelete | cache_session_data_when_delete | bool | Whether to cache the original session data in the database when deleting the session {true,false} def:true |
Enable HTTPS
HTTPS protocol can be enabled by configuring initialization special parameters. For details, see parameter description list.
Example
-
C++
nim::SDKConfig config; //Ability parameters for assembling SDK (required) config.database_encrypt_key_ = "Netease"; //string (db key is required. Now, it is only available to the encryption key with max. 32 characters! It is recommended to use 32 characters.) config.sdk_log_level_ = ; //bool (Optional) It determines to pre-load attachment (image and audio file). It is to preload the attachment by default for SDK. If there is a high requirement for bandwidth flow, the option must be closed and changed to download attachment as required by upper developers. config.preload_image_quality_ = ; //int Quality of preloaded image (optional, value range 0-100) config.preload_image_resize_ = ; //string - It is to implement thumbnail for pre-downloaded image based on length and width (optional), for example, if width is 100 and height is 50, assignment will be 100x50 and the middle is small letter x. config.sync_session_ack_ = true; //bool (Optional) It determines multi-client synchronization for read and unread messages. The value is "true" by default. config.login_max_retry_times_ = ; //int Maximum times for retrying login. If it is necessary, it is recommended to set to 3 and above. The default value is 0. SDK sets the times by default. config.use_https_ = true;//It determines to enable HTTPS protocol. The default value is "true". If the private configuration is "true", default_nos_upload_host_ is required. //Server configurations for assembling independent deployment of SDK (optional) config.use_private_server_ = true; config.rsa_public_key_module_ = "http://xxx"; config.default_nos_download_address_.push_back("http://xxx.xxx.xxx.xxx:xxxx"); config.lbs_address_ = "http://xxx"; config.nos_lbs_address_ = "http://xxx"; config.default_link_address_.push_back("http://xxx.xxx.xxx.xxx:xxxx"); config.default_nos_upload_address_.push_back("http://xxx.xxx.xxx.xxx:xxxx"); config.default_nos_access_address_.push_back("http://xxx.xxx.xxx.xxx:xxxx"); // CommsEase sdk, installation directory for initialization, and user directory are loaded. The first parameter is appkey (a test example is filled in here). bool ret = nim::Client::Init("45c6af3c98409b18a84451215d0bdd6e", "Netease", "", config);
-
C#
When the program C# is running, dll in C++ SDK will be used, and the SDK related dll files (nim.dll, nim\_audio.dll, nim\_tools\_http.dll, nrtc.dll) must be stored in the final file generation directory. If it is missing, the library file (msvcp100.dll and msvcr100.dll) must also be copied to the generation directory. Otherwise, the exception that dll cannot be found may occur. C# provides parameter configuration class NimUtility.NimConfig, and completes parameter configuration through creating the object. var config = new NimUtility.NimConfig(); config.CommonSetting = new SdkCommonSetting(); //Ability parameters for assembling SDK config.CommonSetting.DataBaseEncryptKey = "Netease"; //string (db key is required. Now, it is only available to the encryption key with max. 32 characters! It is recommended to use 32 characters.) config.CommonSetting.LogLevel = SdkLogLevel.Pro; //SDK log history level config.CommonSetting.PredownloadAttachmentThumbnail = True; //bool (Optional) It determines to pre-load attachment (image and audio file). It is to preload the attachment by default for SDK. If there is a high requirement for bandwidth flow, the option must be closed and changed to download attachment as required by upper developers. config.CommonSetting.UsePriviteServer = False; //It determines to use custom server. The default value is "false". If the custom server is used, the object config.PrivateServerSetting must be set. //Server configurations for assembling independent deployment of SDK config.PrivateServerSetting = new SdkPrivateServerSetting(); config.PrivateServerSetting.RSAPublicKey = "http://xxx"; config.PrivateServerSetting.DownloadServerList = new List<string>({"",""}); config.PrivateServerSetting.LbsAddress = "http://xxx"; config.PrivateServerSetting.NOSLbsAddress = "http://xxx"; config.PrivateServerSetting.LinkServerList = new List<string>({"",""}); config.PrivateServerSetting.UploadServerList = new List<string>({"",""}); config.PrivateServerSetting.AccessServerList = new List<string>({"",""}); bool ret = NIM.ClientAPI.Init("45c6af3c98409b18a84451215d0bdd6e", "NIMCSharpDemo", null, config); // CommsEase sdk, installation directory for initialization, and user directory are loaded. The first parameter is appkey (a test example is filled in here).
-
C
typedef bool(*nim_client_init)(const char *app_data_dir, const char *app_install_dir, const char *json_extension); void foo() { // Get the interface for SDK initialization HINSTANCE hInst = LoadLibraryW(L"nim.dll"); nim_client_init func = (nim_client_init) GetProcAddress(hInst, "nim_client_init"); //Initialization parameters for assembling SDK Json::Value config_root; //Ability parameters for assembling SDK (required) Json::Value config_values; config_values[kNIMAppKey] = "xxxx"; //APP key of a user config_values[kNIMDataBaseEncryptKey] = ""; //string (db key is required. Now, it is only available to the encryption key with max. 32 characters! It is recommended to use 32 characters.) config_values[kNIMPreloadAttach] = ; //bool (Optional) It determines to pre-load attachment (image and audio file). It is to preload the attachment by default for SDK. If there is a high requirement for bandwidth flow, the option must be closed and changed to download attachment as required by upper developers. config_values[kNIMPreloadImageQuality] = ; //int Quality of preloaded image (optional, value range 0-100) config_values[kNIMPreloadImageResize] = ; //string - It is to implement thumbnail for pre-downloaded image based on length and width (optional), for example, if width is 100 and height is 50, assignment will be 100x50 and the middle is small letter x. config_values[nim::kNIMSyncSessionAck] = ; //bool (Optional) It determines multi-client synchronization for read and unread messages. The value is "true" by default. config_values[nim::kNIMLoginRetryMaxTimes] = ; //int Maximum times for retrying login. If it is necessary, it is recommended to set to 3 and above. The default value is 0. SDK sets the times by default. config_root[kNIMGlobalConfig] = config_values; //Server configurations for assembling independent deployment of SDK (optional) Json::Value server_values; server_values[kNIMLbsAddress] = "http://xxx"; //lbs address server_values[kNIMNosLbsAddress] = "http://xxx"; //nos lbs address server_values[kNIMDefaultLinkAddress].append("xxx.xxx.xxx.xxx:xxxx"); //Default link address server_values[kNIMDefaultNosUploadAddress].append("http://xxx.xxx.xxx.xxx:xxxx"); //Default nos uploading address server_values[kNIMDefaultNosDownloadAddress].append("http://xxx.xxx.xxx.xxx:xxxx"); //Default nos download address server_values[kNIMRsaPublicKeyModule] = ""; //Key server_values[kNIMRsaVersion] = 0; //Key version config_root[kNIMPrivateServerSetting] = server_values; config_root[kNIMAppKey] = "45c6af3c98409b18a84451215d0bdd6e"; //appkey is required (a test example is filled in here). //Initialize SDK func("appdata path", "app installation path", config_root.toStyledString().c_str()); }
Proxy settings
IM SDK supports socks4, socks4a, socks5 proxies, which can be enabled by configuring global proxy settings (for all modules:IM, audio/video, and whiteboard, but the latter two modules only support socks5 proxy). Proxies for audio/video, and whiteboard can be configured separately, but be ware that their individual proxy settings and global proxy settings can mutually overwritten (the one that is configured later will prevail).
API prototype
-
C++
void SetProxy(NIMProxyType type, const std::string& host, int port, const std::string& user, const std::string& password)
File:nim_cpp_global.h
Namespace:NIM
Class:Global
void SetProxy(NIMProxyType type, const std::string& host, int port, const std::string& user, const std::string& password)
File:nim_cpp_vchat.h
Namespace:NIM
Class:Rts
void SetProxy(NIMProxyType type, const std::string& host, int port, const std::string& user, const std::string& password)
File:nim_cpp_vchat.h
Namespace:NIM
Class:VChat
-
C#
static void SetProxy(NIMProxyType type, string host, int port, string user, string password)
Namespace:NIM
Class:GlobalAPI
static void SetProxy(NIMProxyType type, string host, int port, string user, string password)
Namespace:NIM
Class:RtsAPI
static void NIMVChatSetProxy(NIMProxyType type, string host, int port, string user, string password)
Namespace:NIM
Class:VChatAPI
-
C
void nim_global_set_proxy(enum NIMProxyType type, const char *host, int port, const char *user, const char *password)
File:nim_global.h
void nim_vchat_set_proxy(enum NIMProxyType type, const char *host, int port, const char *user, const char *password)
File:nim_rts.h
void nim_vchat_set_proxy(enum NIMProxyType type, const char *host, int port, const char *user, const char *password)
File:nim_vchat.h
Parameters
- C
Parameter | Type | Description |
---|---|---|
type | NIMProxyType | Proxy type |
host | string | Proxy address |
port | int | port |
user | string | account |
password | string | password |
Return values
No return value.
Example
Example only reflects the setting interface of whiteboard
-
C++
void SetProxy() { nim::Rts::SetProxy(kNIMProxySocks5, "127.0.0.1", 8080, "123456789", "mimatest123"); }
-
C#
void SetProxy() { NIM.VChatAPI.NIMVChatSetProxy(NIMProxyType.kNIMProxySocks5, "127.0.0.1", 8080, "123456789", "mimatest123"); NIM.RtsAPI.SetProxy(NIMProxyType.kNIMProxySocks5, "127.0.0.1", 8080, "123456789", "mimatest123"); }
-
C
typedef void(*nim_rts_set_proxy)(enum NIMProxyType type, const char *host, int port, const char *user, const char *password); void SetProxy() { nim_rts_set_proxy func = (nim_rts_set_proxy) GetProcAddress(hInst, "nim_rts_set_proxy"); func(kNIMProxySocks5, "127.0.0.1", 8080, "123456789", "mimatest123"); }
SDK cleanup
Before leaving the app, call the interface nim_client_cleanup to perform NIM SDK cleanup, and then call the FreeLibrary feature to release nim.dll. For cleanup related precautions, see the subsequent chapter "Logout/Exit and Cleanup SDK".
-
C++
static void Cleanup (const std::string &json_extension="")
File:nim_cpp_client.h
Namespace:NIM
Class:Client
-
C#
static void NIM.ClientAPI.Cleanup()
Namespace:NIM
Class:ClientAPI
-
C
NIM_SDK_DLL_API void nim_client_cleanup (const char *json_extension)
File:nim_client.h