Backendless Support
 
Answered

Rest client subscriber

Hi guys,

we have serious problem and need help.

we are familiar

with rest api of backendless to be subscriber in a channel with specific

subtopic. in android we did following steps and get exactly what i

want.

1. Subscribe to non-default channel. Request: POST .../messaging/channel_name/subscribe.

2. Here I get subscription Id.

3. Post some messages to channel through Messaging console.

4. Run request GET .../messaging/channel_name/<subscriptionId>

5. On the last step I receive a list of messages, just as expected.

6.

About 1 minute later, when my message gone from channel and no message

exists in channel, i send another message, immediately receive last

message properly.

7. every things is ok, every time we send new

message get it in android app as we expected without send GET request

again(step 4).

problem is here....

we did every

things like above with prepared rest api from backendless to get

messages from channel in rest client(WIFI Arduino ESP8266) and get

responses as above, but there is a problem.

when client receive

first list of messages, then we send socond message and client receive

nothing unless we send Get request (step 4) again and again. means for

every message we need send GET request(GET

.../messaging/channel_name/<subscriptionId>).

we try a

solution and it works. put GET request in a loop, so request runs over

and over again, this approach waste either our local sources (Battery

and ....) and server resources(get maximum api/min).

i hope send you enough detail, please tell us what is the right solution.

thanks for your help.

Leave a Comment

Comments (7)

photo
1

Hello,

message TTL is 60 seconds. so you can send one request to get messages per 50 seconds

photo
1

so this means puting our GET request for messages in rest client is fine way? actually?

photo
1

we need subscribe messages every seconds, real time, Depends on your answer we must send one request to get messages every seconds and this approach is out of mind at least for us, in addition Do we need get subscription id every time that we want get messages?

our work stopped for this issue, please help me like before, thanks.

photo
1

There's no other way with request-response model you have in REST. The only way I see it wouldn't require a request each second is connecting via WebSocket, which will probably be possible only in Backendless version 5 (soon), but still I think you gonna need some library support. Which language do you use for this project?

photo
photo
1

Another Question in this topic: if we want to use our MQTT library to publish and subscribe messages, can you get me a Broker URL like: "http://broker.mqtt-dashboard.com/"; but this is public and we want to use your url beside another services we use from backendless.

photo
1

Our pub-sub messaging does not work via MQTT protocol.

photo
1

thanks a lot, we wait for your next version.

photo