Try PubSub+
If you haven't already, check out our new Developer Portal! You'll find useful information about Solace PubSub+ as well as handy resources to get you started.

Doing request/reply over Solace websockets using a custom replyTo Destination

tkunnumpurathtkunnumpurath Member, Employee Posts: 2

If you have a requirement to using a custom replyTo destination for your request using the Solace Websockets API - follow along this tutorial - and make the following enhancements:

Add the following function to the BasicRequestor.js -

requestor.subscribe = function (topicName) { 
         if (requestor.session !== null) { if (requestor.subscribed) { requestor.log('Already subscribed to "' + topicName
        + '" and ready to receive messages.');
        } else {
            requestor.log('Subscribing to topic: ' + topicName); 
            try { 
                    true, // generate confirmation when subscription is added successfully topicName, // use topic name as correlation key
                    10000 // 10 seconds timeout for this operation 
             catch (error) { 
            } else 
                requestor.log('Cannot subscribe because not connected to Solace message router.');

In the requestor.request function, add the following lines of code:

var replyTo = 'REPLY/TOPIC';
Sign In or Register to comment.