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
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
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.