Rams
Rams

Reputation: 2179

Can we publish a pubnub message synchronously using Java sdk

We are writing a messaging app in Java . By default pubnub Java sdk supporting publish a message asynchronously. We are using pubnub 3.7.10 version.

but we want to publish messages using pubnub synchronously . How can we achieve this ??

Thanks

Upvotes: 2

Views: 514

Answers (2)

Ajit Kumar
Ajit Kumar

Reputation: 627

Yes. Please refer to PubNub publish not working post that has the complete code showing how you can make a synchronous publish with PubNub 4.0 SDK version.

Upvotes: 0

Craig Conover
Craig Conover

Reputation: 4738

PubNub Publish Sync

If you can wait a week or two for v4.0 of the PubNub SDK, it is super simple to do sync publishing. It is currently in beta2 but no changes are planned before GA in the next week.

pubNub.publish().message(Arrays.asList({'msg':'hello', 'sender':'user123'})).channel("my_channel").sync();

https://www.pubnub.com/docs/java/api-reference-sdk-v4#publish

Upvotes: 5

Related Questions