Create long polling subscriber.
Behind the scene, DSPS server saves messages for each polling subscribers. You must create subscriber before messages you want to receive. No guarantee whether you can / cannot receive messages that sent before subscriber creation.
You can retry this API with same channelID + subscriberID.
This API success even if the subscriber already exists.
ID of a channel to receive messages.
If not exists, automatically create channel.
ID of the subscriber to create.
Subscriber ID must be unique within the channel.
Note: you can retry this API with the same subscriberID. DSPS server just returns 200 for duplicated requests and not create duplicated internal resources.
No need to send request body to this API.
Returns HTTP 200 with application/json response body if success.
Example:
{
"channelID": "cc457b533ad54a47b0facc44daf51ad8",
"subscriberID": "bf29dd67ced04692bf87500095396d9b"
}ChannelID of the subscriber belongs to, exactly same as request parameter.
ID of the created subscriber, exactly same as request parameter.
Delete subscriber.
No guarantee whether you can / cannot receive messages that sent after subscriber deletion.
You should not create subscriber with the ID deleted before. Should change subscriber ID to create new subscription, otherwise you may encounter confusing race-condition behavior.
You can retry this API with same channelID + subscriberID.
This API success even if specified subscriber does not exists.
ID of the subscriber.
ID of the channel that the subscriber belongs to.
No need to send request body to this API.
Returns HTTP 200 with application/json response body if success.
Note that this API returns 200 even if the subscriber does not exists (see "retry handling" section).
Example:
{
"channelID": "cc457b533ad54a47b0facc44daf51ad8",
"subscriberID": "bf29dd67ced04692bf87500095396d9b"
}ChannelID of the subscriber belongs to, exactly same as request parameter.
ID of the created subscriber, exactly same as request parameter.
Receive messages with long polling.
If there are no messages, this API await for new message arrival with specified timeout.
Important note: This API does not remove received messages from the subscriber. You MUST acknowledge (DELETE) messages immediately after you successfully received message.
You can retry this API.
Until you acknowledge messages from the subscriber, this API returns messages every time you call this API.
ID of the subscriber.
You need to create subscription beforehand.
ID of the channel that the subscriber belongs to.
With this option, server performs long-polling. Long polling is an API interface to await for new message arrival. Server await new message arrival if no messages available on the start of this API.
Note that we strongly recommend long-polling rather than short-polling, it offers low latency and system load efficiency.
Format of the duration is golang ParseDuration syntax (e.g. 1h30m).
If there are so many new messages, server may not return specified count of messages.
Note that server could return some more messages than this value.
Returns HTTP 200 with application/json response body if success.
Example:
{
"channelID": "cc457b533ad54a47b0facc44daf51ad8",
"messages": [
{
"messageID": "my-first-message",
"content": /* any JSON */
}
],
"ackHandle": "B4CF3208,5139-4F71-B260,F7519680A886",
"moreMessages": true
}ChannelID of the channel you sent to, exactly same as request parameter.
List of messages received and not acknowledged yet.
Length of this list depends on following cases:
- 0 length: there are no messages
- 1 or more: there are some messages, list contains all or subset of the messages
- Note that this list may not contain all of the messages.
ID of the message given by message publish API.
Content of the message given by message publish API.
A token to acknowledge (remove) received messages from the subscriber.
Use DELETE API (described below) to delete received messages with this token otherwise you will receive same messages again.
Note: ackHandle is not valid after any DELETE API call. You should hold only last ackHandle you received.
If there are more messages, true.
Acknowledge (remove) received message from the subscriber.
You must acknowledge messages that successfully received.
Note:
- Do not confuse with
DELETE /channel/{channelID}/subscription/polling/{subscriberID}, it deletes subscriber itself. - With some storage type, deleted message could be re-sent even if you call this endpoint in rare case (e.g. due to data loss of Redis Cluster failover).
- By design DSPS server put importance on prevent message lost (misfire) rather than duplicate message delivery.
You can retry this API.
This API success even if specified messages had been already deleted from the subscriber.
ID of the subscriber.
ID of the channel that the subscriber belongs to.
The string returned from the polling endpoint.
Do not pass old ackHandle, always use ackHandle of the latest polling.
No need to send request body to this API.
Returns HTTP 204 (No Content) if success.