Set user subscription
Nexconn allows you to subscribe to user online status. You can set up subscriptions from both the client and server side.
Request method
POST: https://Base URL/user/subscribe/set.json
Signature required: All server API requests require signature verification. See API request signature.
Rate limit: 100 requests per second
Request body
The request body is in application/x-www-form-urlencoded format and supports the following form parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
subType | Int | No | Defaults to 1 (status subscription). |
userId | String | Yes | The subscriber's user ID. |
subUserIds | String | Yes | Comma-separated list of user IDs to subscribe to. Maximum 200 per request. |
opType | Int | Yes | Operation type. 0 = subscribe. 1 = unsubscribe. |
expiry | Long | No | Subscription duration in seconds. Required when opType is 0. |
Request example
HTTP
POST /user/subscribe/set.json HTTP/1.1
Host: api-cn.ronghub.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded
userId=uid1&subUserIds=s_user1,s_user2&opType=0&expiry=60&subType=1
Response
| Field | Type | Description |
|---|---|---|
code | Int | Status code. 200 indicates success. |
subUserIds | String[] | Returned when code is 26021. Lists users that reached subscription limits. |
Error codes
| Code | HTTP Status | Description |
|---|---|---|
200 | 200 | Success |
26001 | 400 | Invalid request parameters |
26003 | 500 | Internal error |
26022 | 403 | Subscriber limit exceeded |
26021 | 200 | Subscribed user limit reached |
26020 | 401 | Subscription feature not enabled |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":200}