### Create or Update Device Example Request and Response Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Example curl command to create or update a device, followed by the expected JSON response containing the device ID, token, and secret. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"deviceId\":\"device1\", \ \"owners\":[\"user1\",\"user2\"], \ \"extra\":\"extra info\" \ }" \ http://localhost:18080/admin/device/create_or_update ``` ```json { "code":0, "msg":"success", "result":{ "deviceId":"device1", "token":"token123", "secret":"secret456" } } ``` -------------------------------- ### 启动 MCP 服务(stdio 和 HTTP 模式) Source: https://docs.wildfirechat.cn/blogs/%E9%87%8E%E7%81%AB%E6%9C%BA%E5%99%A8%E4%BA%BAMCP%E6%9C%8D%E5%8A%A1%E7%AE%80%E4%BB%8B.html 通过 npm start 启动服务。本地模式直接运行,HTTP 模式需先设置 WF_MCP_PORT 环境变量指定端口。 ```shell # 本地模式 npm start # HTTP 模式 export WF_MCP_PORT=3100 npm start ``` -------------------------------- ### Register/Update User - curl Example Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Example curl command to create a user with name 'a' and displayName 'A'. The response shows a success code and the generated userId. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"name\":\"a\",\"displayName\":\"A\"}" http://localhost:18080/admin/user/create { "code":0, "msg":"success", "result":{ "userId":"a", } } ``` -------------------------------- ### Verify User Example Request and Response Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Example curl command to call the user verification endpoint, followed by the expected JSON response containing the user ID, display name, and portrait URL. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"authCode\":\"authCode1\"}" http://domain:18080/admin/user/app_get_user_info ``` ```json { "code":0, "msg":"success" "result":{ "userId":"userid1", "dispalyName":"name1", "portraitUrl":"url" } } ``` -------------------------------- ### Install electron-updater dependency Source: https://docs.wildfirechat.cn/blogs/electron-auto-updater-guide.html Run this command to install the electron-updater package as a dependency. ```bash npm install electron-updater --save ``` -------------------------------- ### 安装系统依赖 (yum install make gcc openssl-devel libevent) Source: https://docs.wildfirechat.cn/webrtc/turn_server.html 在CentOS上安装编译coturn所需的系统依赖包,包括make、gcc、openssl-devel和libevent。注意OpenSSL需要是1.0.2或1.x,因为coturn 4.5.1.3与OpenSSL 3.x不兼容。 ```bash sudo yum install -y make gcc cc gcc-c++ wget sudo yum install -y openssl-devel libevent libevent-devel ``` -------------------------------- ### Initialize WFCCNetworkService before use Source: https://docs.wildfirechat.cn/faq/ios.html Initialize the network service by starting logs, setting server address, and connecting with user ID and token. Must be called before any other API usage. ```objectivec [WFCCNetworkService startLog]; [[WFCCNetworkService sharedInstance] setServerAddress:IM_SERVER]; [[WFCCNetworkService sharedInstance] connect:userId token:token]; ``` -------------------------------- ### List conference rooms - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/conference_api.html Example curl command to list conference rooms, followed by a sample JSON response. The response contains a result array with conference room objects. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" http://localhost:18080/admin//conference/list { "code":0, "msg":"success", "result":[{ "roomId":"aaaa", "serverId":"aaaa", ... } ] } ``` -------------------------------- ### Get robot info - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Example curl command to get robot info for robotId 'a', followed by the JSON response with robot details. Note: the response example has a missing comma after 'owner' field, which is a typo in the source. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"robotId\":\"a\"}" http://localhost:18080/admin/user/get_robot_info { "code":0, "msg":"success", "result":{ "userId":"a", "name":"usera", "owner":"userId2" "secret":"123456" } } ``` -------------------------------- ### 配置Config.java的IM服务器地址 Source: https://docs.wildfirechat.cn/faq/android/q2.html 在调用WfcUIKit#init之前,对Config类的字段进行赋值,例如设置IM服务器主机地址。 ```java Config.IM_SERVER_HOST = "im.example.com"; ... ``` -------------------------------- ### 安装编译依赖(python和build-essential) Source: https://docs.wildfirechat.cn/blogs/%E5%9B%BD%E4%BA%A7%E5%8C%96%E7%B3%BB%E7%BB%9F%E9%B2%B2%E9%B9%8FCPU%2BUOS%E9%80%82%E9%85%8D%E7%BB%8F%E5%8E%86.html 在UOS上通过apt命令安装编译所需的依赖包。需要先打开开发者模式。 ```bash sudo apt update sudo apt install python,build-essential ``` -------------------------------- ### Get group remark - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html Example curl request to get a group remark. The body includes userId, scope=26, and key=groupId. The response returns the remark in the value field. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"userId\":\"user1\", \ \"scope\": 26, \ \"key\": \"groupId1\" \ }" \ http://localhost:18080/admin/user/get_setting ``` ```json { "code":0, "msg":"success", "result":{ "scope":26, "key":"groupId1", "value":"重要群组" } } ``` -------------------------------- ### 注册用户通知设置 Source: https://docs.wildfirechat.cn/ios/ios_integration.html 在application:didFinishLaunchingWithOptions:中注册用户通知设置,兼容iOS 10及以上和旧版本。 ```objectivec if (@available(iOS 10.0, *)) { //第一步:获取推送通知中心 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert|UNAuthorizationOptionSound|UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (!error) { NSLog(@"succeeded!"); dispatch_async(dispatch_get_main_queue(), ^{ [application registerForRemoteNotifications]; }); } }]; } else { UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]; [application registerUserNotificationSettings:settings]; } ``` -------------------------------- ### Get user online status - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Example curl command to get online status for user 'a', followed by the JSON response showing session details. The response includes a list of sessions with clientId, userId, platform, status (0 online, 1 offline), and lastSeen. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\"}" http://localhost:18080/admin/user/onlinestatus { "code":0, "msg":"success", "result":[{ "clientId":"clientidxxx", "userId":"useridxxx", "platform":0, "status":0, "lastSeen":1392312342 }] } ``` -------------------------------- ### Get common groups of two users - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html Example for POST /admin/group/common_group. The request body requires 'first' and 'second' user IDs. The response contains a 'groupIds' list. This endpoint is not recommended for high-frequency use due to performance concerns. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"first\":\"userId1\", \ \"second\":\"userId2\", \ }" \ http://localhost:18080/admin/group/common_group ``` ```json { "code":0, "msg":"success", "result":{ "groupIds":["groupId1", "groupId2", "groupId3"] } } ``` -------------------------------- ### wf.ready Source: https://docs.wildfirechat.cn/open/jssdk.html config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。 ```APIDOC ## wf.ready ### Description config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。 ### Method ready ### Parameters #### Callback - **callback** (function) - 必填 - 验证成功后的回调函数 ### Request Example ``` wf.ready(function(){ // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。 }); ``` ### Response #### Success Response - **errMsg** (string) - 调用成功时:"xxx:ok",其中xxx为调用的接口名 #### Response Example ``` { "errMsg": "ready:ok" } ``` ### Error Handling - 调用失败时:errMsg为具体错误信息 ``` -------------------------------- ### Get single moment - curl example Source: https://docs.wildfirechat.cn/server/robot_api/moments_api.html Curl command to retrieve a moment with feedId 123456789, followed by the JSON response containing the moment details. ```bash curl -X POST -H "nonce:76616" -H "timestamp\":\"1558350862502\" -H "sign\":\"b98f9b0717f59febccf1440067a7f50d9b31bdde\" -H "Content-Type:application/json" -H "rid":"robota" -d \"{\\\"feedId\\\":123456789}\" http://localhost/robot/moments/feed/pull_one { "code":0, "msg":"success", "result":{ "feedId":123456789, "sender\":\"user1\", "text\":\"今天天气真好!\", "timestamp\":13123423234324 } } ``` -------------------------------- ### Get all users (paginated) - curl example Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Sends a POST request to /admin/user/all with a JSON body containing count and offset for pagination. The response includes a list of users. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"count\":10,\"offset\":0}" http://localhost:18080/admin/user/all ``` ```json { "code":0, "msg":"success", "result":[ { "userId":"user1", "name":"name1" } ] } ``` -------------------------------- ### 修改 /etc/systemd/system.conf 设置 DefaultLimitNOFILE Source: https://docs.wildfirechat.cn/server/system_tune.html 在 /etc/systemd/system.conf 中设置 DefaultLimitNOFILE 以调整系统服务文件描述符限制。 ```bash DefaultLimitNOFILE=1000000 ``` -------------------------------- ### wf.ready 处理成功验证 Source: https://docs.wildfirechat.cn/open/jssdk.html 处理config验证成功后的回调,所有接口调用都必须在config接口获得结果之后。若需在页面加载时调用接口,应将其放在ready函数中。 ```javascript wf.ready(function(){ // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。 }); ``` -------------------------------- ### Get chatroom blacklist - curl example Source: https://docs.wildfirechat.cn/server/admin_api/chatroom_api.html Sends a POST request to /admin/chatroom/get_black_status with a chatroomId. The response includes a list of blacklist entries with userId, state, and optional expiredTime. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"chatroomId\":\"aaaa\"}" http://localhost:18080/admin/chatroom/get_black_status { "code":0, "msg":"success", "result":{ infos:[ {"userId":"user1","state":1,expiredTime:0}, {"userId":"user2","state":2,expiredTime:365400} ] } } ``` -------------------------------- ### Get user by email - curl example Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Sends a POST request to /admin/user/get_info_by_email with a JSON body containing the email address. The response includes a list of users matching that email. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "\"user1@example.com\"" http://localhost:18080/admin/user/get_info_by_email ``` ```json { "code":0, "msg":"success", "result":[ { "userId":"user1", "name":"name1", "email":"user1@example.com" } ] } ``` -------------------------------- ### 七牛云存储配置示例 Source: https://docs.wildfirechat.cn/server/oss_config_sample.html 配置七牛云作为媒体服务器,需设置上传地址(如up.qbox.me)、端口、访问密钥和各个bucket的名称及域名。注意server_host不能带http头和port,port配置在media.server_port和media.server_ssl_port属性。 ```properties ## qiniu media server configuration ## 上传地址,不同的区域,上传地址也不同,七牛文档上有区域和地址的对应关系,华东地区默认是up.qbox.me。 ## server_host与社区版不同,不能带http头和port。port配置在media.server_port和media.server_ssl_port属性。 media.server_host up.qbox.me media.server_port 80 media.server_ssl_port 443 media.access_key tU3vdBK5BL5j4N7jI5N5uZgq_HQDo170w5C9Amnn media.secret_key YfQIJdgp5YGhwEw14vGpaD2HJZsuJldWtqens7i5 ## bucket名字及Domain media.bucket_general_name media media.bucket_general_domain http://cdn.wildfirechat.cn media.bucket_image_name media media.bucket_image_domain http://cdn.wildfirechat.cn media.bucket_voice_name media media.bucket_voice_domain http://cdn.wildfirechat.cn media.bucket_video_name media media.bucket_video_domain http://cdn.wildfirechat.cn media.bucket_file_name media media.bucket_file_domain http://cdn.wildfirechat.cn media.bucket_sticker_name media media.bucket_sticker_domain http://cdn.wildfirechat.cn media.bucket_moments_name media media.bucket_moments_domain http://cdn.wildfirechat.cn media.bucket_portrait_name storage media.bucket_portrait_domain http://cdn2.wildfirechat.cn media.bucket_favorite_name storage media.bucket_favorite_domain http://cdn2.wildfirechat.cn ``` -------------------------------- ### Get friend alias (get_alias) - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/user_relation.html Retrieves the alias for a friend relationship. The request body includes operator and targetId. The response includes the alias in the result object. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"operator\":\"a\",\"targetId\":\"a\"}" http://localhost:18080/admin/friend/get_alias ``` ```json { "code":0, "msg":"success", "result":{ "operator":"a", "targetId":"b", "alias":"Mr.Hello" } } ``` -------------------------------- ### 修改 /etc/security/limits.conf 设置用户文件句柄限制 Source: https://docs.wildfirechat.cn/server/system_tune.html 在 /etc/security/limits.conf 中设置用户允许打开的最大文件句柄数。 ```bash * soft nofile 1000000 * hard nofile 1000000 ``` -------------------------------- ### 初始化WFCCNetworkService Source: https://docs.wildfirechat.cn/ios/ios_integration.html 在application:didFinishLaunchingWithOptions:中启动日志、设置代理和服务器地址。 ```objectivec [WFCCNetworkService startLog]; [WFCCNetworkService sharedInstance].connectionStatusDelegate = self; [WFCCNetworkService sharedInstance].receiveMessageDelegate = self; [[WFCCNetworkService sharedInstance] setServerAddress:IM_SERVER_HOST]; ``` -------------------------------- ### Get user group list by member type - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html Example for POST /admin/group/of_user_by_type. The request body requires 'userId' and 'groupMemberType' (array of ints: 0 normal member, 1 admin, 2 owner). The response contains a 'groupIds' list. This endpoint is not recommended for high-frequency use due to performance concerns. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"userId\":\"userId1\", \ \"groupMemberType\":[0, 2] \ }" \ http://localhost:18080/admin/group/of_user_by_type ``` ```json { "code":0, "msg":"success", "result":{ "groupIds":["groupId1", "groupId2"] } } ``` -------------------------------- ### 配置 turnserver.conf Source: https://docs.wildfirechat.cn/webrtc/turn_server.html 修改turnserver配置文件,设置监听IP、中继IP、外部IP、用户密码和UDP端口范围。默认配置模板位于/usr/local/etc/turnserver.conf.default,需要复制为/usr/local/etc/turnserver.conf。如果服务器只有一个IP,内网IP和外网IP使用同一个IP。 ```ini listening-ip=${内网IP} relay-ip=${内网IP} external-ip=${外网IP} user=username:password min-port=49152 max-port=65535 ``` -------------------------------- ### Get user relation - curl example Source: https://docs.wildfirechat.cn/server/admin_api/user_relation.html Retrieves the relationship between two users via the /admin/relation/get endpoint. The request includes operator and targetId parameters. The response contains user details such as alias, isFriend, and isBlacked. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"operator\":\"a\",\"targetId\":\"a\"}" http://localhost:18080/admin/relation/get ``` ```json { "code":0, "msg":"success", "result":{ "userId":"a", "targetId":"b", "alias":"Mr.Hello", "isFriend":true } } ``` -------------------------------- ### Get User Group List - curl Example Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html POST request to /admin/group/of_user with a userId parameter. The response includes a result object with a list of groupIds. This endpoint is not recommended for high-frequency use due to potential performance issues. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"userId\":\"userId1\" \ }" \ http://localhost:18080/admin/group/of_user ``` ```json { "code":0, "msg":"success", "result":{ "groupIds":["groupId1", "groupId2", "groupId3"] } } ``` -------------------------------- ### Get blacklist list via /admin/blacklist/list Source: https://docs.wildfirechat.cn/server/admin_api/user_relation.html Retrieves the blacklist for a given user. The endpoint is POST /admin/blacklist/list. The example shows a curl request with the required userId in the body and the response containing a result array of blacklisted UIDs. ```text http://domain:18080/admin/blacklist/list ``` ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\"}" http://localhost:18080/admin/blacklist/status { "code":0, "msg":"success", "result":[ "b" ] } ``` -------------------------------- ### POST /admin/user/get_setting Source: https://docs.wildfirechat.cn/server/admin_api/general_api.html 获取用户设置,仅专业版IM服务支持此接口。 ```APIDOC ## POST /admin/user/get_setting ### Description 获取用户设置,仅专业版IM服务支持此接口。 ### Method POST ### Endpoint http://domain:18080/admin/user/get_setting ### Parameters #### Request Body - **userId** (string) - 必需 - 用户ID - **scope** (int) - 必需 - 设置类型 - **key** (string) - 可选 - 设置的Key值 ### Request Example ``` curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\",\"scope\":1001,\"key\":\"b\",\"value\":\"c\"}" http://localhost:18080/admin/user/get_setting ``` ### Response #### Success Response (200) - **userId** (string) - 用户ID - **scope** (int) - 设置类型 - **key** (string) - 设置的Key值 - **value** (string) - 设置的Value #### Response Example ``` { "code":0, "msg":"success", "result":{ "userId":"a", "scope":1001, "key":"b", "value":"c" } } ``` ``` -------------------------------- ### Get all robots (paginated) - curl request and response Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Sends a POST request to /admin/user/get_all_robots with count and offset in the JSON body. The response contains a robotInfoList with robot details. The example uses nonce, timestamp, and sign headers for authentication. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"count\":10,\"offset\":0}" http://localhost:18080/admin/user/get_all_robots { "code":0, "msg":"success", "result":{ "robotInfoList":[ { "userId":"robot1", "name":"robotname1", "displayName":"机器人1", "owner":"user1", "secret":"xxxxx" } ] } } ``` -------------------------------- ### AVEngineKit.init Source: https://docs.wildfirechat.cn/blogs/AVENGINE_DEVELOPER_GUIDE.html Initializes the AVEngineKit with a RobotService and a callback for engine events. ```APIDOC ## AVEngineKit.init ### Description Initializes the AVEngineKit with a RobotService and a callback for engine events. ### Method init ### Signature public void init(RobotService robotService, AVEngineKitCallback engineKitCallback) ### Parameters - **robotService** (RobotService) - Required - The robot service instance. - **engineKitCallback** (AVEngineKitCallback) - Required - Callback for engine events. ``` -------------------------------- ### Get friend list via /admin/friend/list Source: https://docs.wildfirechat.cn/server/admin_api/user_relation.html Retrieves the friend list for a given user. The endpoint is POST /admin/friend/list. The example shows a curl request with the required userId in the body and the response containing a result array of friend UIDs. ```text http://domain:18080/admin/friend/list ``` ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\"}" http://localhost:18080/admin/friend/status { "code":0, "msg":"success", "result":[ "b" ] } ``` -------------------------------- ### 关闭TURN服务日志 Source: https://docs.wildfirechat.cn/webrtc/turn_server.html 在配置文件中添加log-file=/dev/null来关闭日志,避免生成大量日志文件占满磁盘空间。 ```ini log-file=/dev/null ``` -------------------------------- ### 初始化机器人服务和音视频引擎 Source: https://docs.wildfirechat.cn/blogs/AVENGINE_DEVELOPER_GUIDE.html 使用机器人用户ID和密码初始化 RobotService,然后传入 AVEngineKit.init() 完成音视频引擎初始化。 ```java // 初始化机器人服务(野火SDK提供) RobotService robotService = new RobotService(IM_SERVER_URL, ROBOT_USER_ID, ROBOT_PASSWORD); // 初始化音视频引擎 AVEngineKit.getInstance().init(robotService, engineKitCallback); ``` -------------------------------- ### AVEngineKit init method Source: https://docs.wildfirechat.cn/blogs/AVENGINE_DEVELOPER_GUIDE.html Initializes the AVEngineKit with a RobotService and an AVEngineKitCallback. ```java public void init(RobotService robotService, AVEngineKitCallback engineKitCallback) ``` -------------------------------- ### Get robot info - endpoint URL Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html The URL for the admin API to get robot information. Use POST with body containing robotId. ```text http://domain:18080/admin/user/get_robot_info ``` -------------------------------- ### 安装 deb 包 (Ubuntu/Debian) Source: https://docs.wildfirechat.cn/blogs/systemd.html 在 Debian 系 Linux 系统(如 Ubuntu)中使用 apt 命令本地安装 im-server.deb 包。注意使用 ./ 前缀表示本地文件,若使用 dpkg -i 将不会安装依赖。 ```bash sudo apt install ./im-server.deb ``` -------------------------------- ### Get group remark - endpoint URL Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html The admin endpoint to get a user's group remark. It reuses the user settings interface with scope=26 and key=groupId. ```text http://domain:18080/admin/user/get_setting ``` -------------------------------- ### 编译安装 coturn 4.5.1.3 Source: https://docs.wildfirechat.cn/webrtc/turn_server.html 从源码编译安装coturn TURN服务器。下载coturn 4.5.1.3源码包,解压后执行configure、make和make install。如果编译失败,可能是OpenSSL版本不兼容,需要确保OpenSSL版本为1.0.2或1.x。 ```bash wget https://github.com/coturn/coturn/archive/4.5.1.3.tar.gz tar -xvzf 4.5.1.3.tar.gz cd coturn-4.5.1.3 && ./configure make sudo make install ``` -------------------------------- ### 使用rvictl创建虚拟网卡 Source: https://docs.wildfirechat.cn/blogs/iOS%E5%A6%82%E4%BD%95%E6%8A%93%E7%BD%91%E7%BB%9C%E5%8C%85.html 在终端执行此命令,将UUID替换为设备的UUID,成功后会出现提示'Starting device UUID [SUCCEEDED] with interface rvi0',其中rvi0为虚拟网卡名称。 ```bash rvictl -s UUID ``` -------------------------------- ### Multicast message curl example Source: https://docs.wildfirechat.cn/server/admin_api/message_api.html Example curl command to send a multicast message. The request includes sender, targets, and payload. The response includes messageUid and timestamp. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"sender\":\"a\", \ \"targets\": [\"userId1\",\"userId2\"], \ \"payload\":{ \ \"type\":1, \ \"searchableContent\":\"hello\" \ } \ }" \ http://localhost:18080/admin/message/multicast { "code":0, "msg":"success", "result":{ "messageUid":5323423532, "timestamp":13123423234324, } } ``` -------------------------------- ### latest.yml content example Source: https://docs.wildfirechat.cn/blogs/electron-auto-updater-guide.html Example of the latest.yml file that electron-updater downloads to check for updates. It contains the version, file list with sha512 and size, path, sha512, and releaseDate. ```yaml version: 1.1.1 files: - url: 野火IM-1.1.1-win-x64-setup.exe sha512: xxxxxxxx... size: 12345678 blockMapSize: 1234 path: 野火IM-1.1.1-win-x64-setup.exe sha512: xxxxxxxx... releaseDate: '2024-01-15T10:00:00.000Z' ``` -------------------------------- ### 设置并发连接 backlog 参数 Source: https://docs.wildfirechat.cn/server/system_tune.html 使用 sysctl 设置 net.core.somaxconn、net.ipv4.tcp_max_syn_backlog 和 net.core.netdev_max_backlog 以调整并发连接队列。 ```bash sysctl -w net.core.somaxconn=32768 sysctl -w net.ipv4.tcp_max_syn_backlog=16384 sysctl -w net.core.netdev_max_backlog=16384 ``` -------------------------------- ### 设置角标(applicationDidEnterBackground) Source: https://docs.wildfirechat.cn/ios/ios_integration.html 程序退到后台时读取未读数并设置应用角标,包括好友请求未读数。 ```objectivec -(void)applicationDidEnterBackground:(UIApplication *)application { WFCCUnreadCount *unreadCount = [[WFCCIMService sharedWFCIMService] getUnreadCount:@[@(Single_Type), @(Group_Type), @(Channel_Type)] lines:@[@(0)]]; int unreadFriendRequest = [[WFCCIMService sharedWFCIMService] getUnreadFriendRequestStatus]; [UIApplication sharedApplication].applicationIconBadgeNumber = unreadCount.unread + unreadFriendRequest; } ``` -------------------------------- ### Get user online status - endpoint URL Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html The URL for the admin API to get a user's online status. Use POST with the body containing userId. ```text http://domain:18080/admin/user/onlinestatus ``` -------------------------------- ### POST /admin/get_setting Source: https://docs.wildfirechat.cn/server/admin_api/general_api.html Retrieves a system-level setting by its ID. The response includes the setting ID, value, and optional description. ```APIDOC ## POST /admin/get_setting ### Description 获取系统级别的设置信息。 ### Method POST ### Endpoint http://domain:18080/admin/get_setting ### Parameters #### Request Body - **id** (int) - Required - 设置ID ### Request Example ``` curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"id\":1}" http://localhost:18080/admin/get_setting ``` ### Response #### Success Response (200) - **id** (int) - 设置ID - **value** (string) - 设置值 - **desc** (string) - 设置描述 #### Response Example ``` { "code":0, "msg":"success", "result":{ "id":1, "value":"setting_value", "desc":"setting description" } } ``` ``` -------------------------------- ### Register/Update Robot - curl Example Source: https://docs.wildfirechat.cn/server/admin_api/user_api.html Example curl command to create a robot with name 'a', displayName 'A', callback URL, and owner 'b'. The response includes the robot userId and secret. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"name\":\"a\",\"displayName\":\"A\",\"callback\":\"http://localhost/robot\",\"owner\":\"b\"}" http://localhost:18080/admin/robot/create { "code":0, "msg":"success", "result":{ "userId":"a", "secret":"xxxxx" } } ``` -------------------------------- ### 初始化 OpenClaw 配置 Source: https://docs.wildfirechat.cn/blogs/%E9%87%8E%E7%81%ABIM%C3%97OpenClaw%EF%BC%9A%E6%89%93%E9%80%A0%E4%BD%A0%E7%9A%84%E7%A7%81%E6%9C%89%E5%8C%96AI%E5%8A%A9%E6%89%8B.html 运行openclaw onboard命令初始化配置,引导选择模型提供商、输入API Key、配置网关端口(默认18789)。 ```bash openclaw onboard --install-daemon ``` -------------------------------- ### Recall message curl example Source: https://docs.wildfirechat.cn/server/admin_api/message_api.html Example curl command to recall a message. The request includes operator and messageUid. The response shows success with code 0 and msg success. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"operator\":\"a\",\"messageUid\":5323423532}" http://localhost:18080/admin/message/recall { "code":0, "msg":"success", } ``` -------------------------------- ### 被叫方加入通话时序 Source: https://docs.wildfirechat.cn/blogs/AVENGINE_DEVELOPER_GUIDE.html 被叫方加入通话的典型时序,包括接收Type400、发送Type401、发送join_pub、接收响应、创建PeerConnection、发送message (configure+offer)、接收answer、发送trickle、接收publishers事件、发送join_sub、接收offer、创建Answer、发送message (start+answer)、媒体连接建立成功。 ```text 1. 接收 Type400 消息 2. 发送 Type401 接听消息 3. 发送 join_pub → 4. ← 接收响应(attendees/publishers) 5. 创建PeerConnection,发送 message (configure+offer) → 6. ← 接收响应(answer) 7. 发送 trickle (ICE candidates) → 8. ← 接收 publishers 事件(主叫方已在发布) 9. 发送 join_sub → 10. ← 接收响应(offer) 11. 创建Answer,发送 message (start+answer) → 12. 媒体连接建立成功 ``` -------------------------------- ### Send message example with curl Source: https://docs.wildfirechat.cn/server/robot_api Example of sending a message with curl, including required headers (nonce, timestamp, sign, rid) and the JSON body. The response shows the messageUid and timestamp. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -H "rid":"robota" -d \ "{ \ \"conv\": { \ \"type\":1, \ \"target\":\"a\", \ \"line\":0, \ }, \ \"payload\":{ \ \"type\":1, \ \"searchableContent\":\"hello\" \ } \ }" \ http://localhost/robot/message/send { "code":0, "msg":"success", "result":{ "messageUid":5323423532, "timestamp":13123423234324, } } ``` -------------------------------- ### 修改 /etc/sysctl.conf 文件参数 fs.file-max Source: https://docs.wildfirechat.cn/server/system_tune.html 在 /etc/sysctl.conf 文件中设置 fs.file-max 参数,用于持久化文件句柄限制。 ```bash fs.file-max = 1000000 ``` -------------------------------- ### Update message curl example Source: https://docs.wildfirechat.cn/server/admin_api/message_api.html Example curl command to update a message. The request includes operator, messageUid, payload, and distribute fields. The response shows success with code 0. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"messageUid\":5323423532, \ \"distribute\":1, \ \"payload\":{ \ \"type\":1, \ \"searchableContent\":\"world\" \ } \ }" \ http://localhost:18080/admin/message/update { "code":0, "msg":"success" } ``` -------------------------------- ### List conference participants - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/conference_api.html Example curl command to list participants of a room, including a sample JSON response. The request body includes the roomId parameter. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"roomId\":\"aaaa\"}" http://localhost:18080/admin/conference/list_participant { "code":0, "msg":"success", "result":[{ "roomId":"aaaa", "serverId":"aaaa", ... } ] } ``` -------------------------------- ### Set/Cancel Group Whitelist Members - curl Example Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html POST request to /admin/group/manager/allow with operator, group_id, and members. The is_manager field is documented but not included in the example. The response is a JSON object with code and msg. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"operator\":\"a\", \ \"group_id\":\"groupId1\", \ \"members\": [ \ \"memberId1\", \ ] \ }" \ http://localhost:18080/admin/group/manager/allow ``` ```json { "code":0, "msg":"success" } ``` -------------------------------- ### wf.config 注入权限验证配置 Source: https://docs.wildfirechat.cn/open/jssdk.html 注入权限验证配置,所有需要使用JS-SDK的页面必须先调用此接口,否则无法调用其他接口。同一个url仅需调用一次,对于变化url的SPA可在每次url变化时调用。 ```javascript wf.config({ appId: '', // 必填,机器人或频道的唯一标识 appType: 0, // 必填,应用类型,0是机器人,1是频道 timestamp: , // 必填,生成签名的时间戳 nonceStr: '', // 必填,生成签名的随机串 signature: '',// 必填,签名 jsApiList: [] // 必填,需要使用的JS接口列表 }); ``` -------------------------------- ### 关闭和刷新 Swap 分区命令 Source: https://docs.wildfirechat.cn/server/mysql_tune.html 用于关闭、开启或刷新 swap 分区的 Linux 命令。刷新 swap 会将数据转储回内存并清空 swap,适用于内存充足的数据库服务器。 ```bash sync # 先执行下同步 swapoff -a # 关闭swap分区 swapon -a # 开启swap分区 swapoff -a && swapon -a # 刷新swap空间,即将SWAP里的数据转储回内存,并清空SWAP里的数据。刷新原理就是把swap关闭后再重启。 ``` -------------------------------- ### 引入野火相关头文件 Source: https://docs.wildfirechat.cn/ios/ios_integration.html 在AppDelegate中引入WFChatClient、WFAVEngineKit、WFChatUIKit和UserNotifications的头文件。 ```objectivec #import #import #import #import ``` -------------------------------- ### 配置组织架构服务的数据源 Source: https://docs.wildfirechat.cn/blogs/%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E7%94%A8%E6%88%B7%E5%B9%B6%E8%AE%BE%E7%BD%AE%E5%AF%86%E7%A0%81.html 在组织架构服务的配置文件 application.properties 中,配置第二个数据源,指向应用服务的数据库,以便修改应用服务中的用户密码。 ```properties spring.secondary-datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/appdata?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true spring.secondary-datasource.hikari.username=root spring.secondary-datasource.hikari.password=123456 spring.secondary-datasource.hikari.driver-class-name=com.mysql.cj.jdbc.Driver ``` -------------------------------- ### Favorite group - curl example and response Source: https://docs.wildfirechat.cn/server/admin_api/group_api.html Example curl request to set a group as favorite. The body includes userId, scope=6, key=groupId, and value "1". The response is a success message with no result. ```bash curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d \ "{ \ \"userId\":\"user1\", \ \"scope\": 6, \ \"key\": \"groupId1\", \ \"value\": \"1\" \ }" \ http://localhost:18080/admin/user/put_setting ``` ```json { "code":0, "msg":"success" } ```