I am trying to setup a webserver that is able to send messages to a message queue. For this, I want to use STOMPIT
. I have setup a basic nodejs webserver with an index.html, main.js and app.js but can't get the stompit library working in my main.js.
How can I use the library (imported with the script tags in the html) in my main.js?
Parts of the code: index.html:
<script src="https://cdnjs.cloudflare.com/ajax/libs/stomp.js/2.3.3/stomp.js"></script>
<script src="js/main.js"></script>
main.js:
stompit.connect(connectOptions, function(error, client) { //stompit is undefined here
if (error) {
console.log('connect error ' + error.message);
return;
}
const sendHeaders = {
'destination': '/queue/test',
'content-type': 'text/plain'
};
const frame = client.send(sendHeaders);
frame.write(msg);
frame.end();
})