Closed azriel46d closed 4 years ago
I have not tested binary messages with ActiveMQ. I will setup a broker and test in the coming week.
I tried couple of different ways, so far no success. If you figure out something please let me know.
So far anything I have tried has failed as well. I will probably attempt with a different library first to see if somehow it is an issue there as well.
As per their documentation if AnctiveMQ finds a content-length header it treats the payload as binary (https://activemq.apache.org/stomp.html#Stomp-WorkingwithJMSText/BytesMessagesandStomp). This library by default adds content-length header.
If you test with other library or combination it will be really helpful.
If you are already using ActiveMQ it may be helpful if you can send a binary message from outside WebStomp and check if this library is able to receive it.
Moved to #113
Hi
Thanks for providing a great library, even though I haven't quite got it to work yet.
I'm hoping to connect to a ActiveMQ server, which will send GZIP messages.
I tried:
https://github.com/easternbloc/node-stomp-client Following an article I read here: https://medium.com/@mackplevine/using-activemq-with-node-js-stomp-and-http-b251ce8d995
I manage to connect to the client using the package, with the following:
var options = {
address: 'some url',
port: '61613',
user: 'username',
pass: 'password',
protocolVersion: '1.0' <-- could also be '1.1'
}
var stompClient = new require('stomp-client')(options);
stompClient.connect(function(sessionId) {
stompClient.subscribe('/topic/...', function(body, headers) {
}
})
I manage to make a connection and it's stable. However, without a major overhaul the stomp-client project cannot process message bodies which are sent compressed (gzip).
I came across your library, which appears to handle binary messages. However, I'm unable to connect to the ActiveMQ server.
Here's my attempt:
var options = {
address: 'some url',
port: '61613',
user: 'username',
pass: 'password',
protocolVersion: '1.0' <-- could also be '1.1'
}
const stompConfig = {
connectHeaders: {
login: options["address"],
passcode: options["pass"]
},
brokerURL: "ws://" + options["address"] + ":" + options["port"],
debug: function (str) {
console.log('STOMP: ' + str);
},
reconnectDelay: 200,
onConnect: function (frame) {
const subscription = stompClient.subscribe('/topic/ ... .... ', function (message) {
console.log(message);
});
}
};
stompClient = new StompJs.Client(stompConfig);
stompClient.activate();
I've tried various things options with address, prefixing it with "ws://" and without. stomp-client didn't require "ws://".
I'm running this in a node client and I get the following error message:
(node:4226) UnhandledPromiseRejectionWarning: ReferenceError: WebSocket is not defined
at Client../src/client.ts.Client._createWebSocket (.../app/index/node_modules/@stomp/stompjs/bundles/stomp.umd.js:420:13)
at Client.<anonymous> (.../app/index/node_modules/@stomp/stompjs/bundles/stomp.umd.js:361:48)
at step (.../app/index/node_modules/@stomp/stompjs/bundles/stomp.umd.js:165:23)
at Object.next (.../app/index/node_modules/@stomp/stompjs/bundles/stomp.umd.js:146:53)
at fulfilled (.../app/index/node_modules/@stomp/stompjs/bundles/stomp.umd.js:137:58)
at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:4226) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4226) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I can confirm I've installed websocket using npm.
Any suggestions please?
Thank you.
I have tested with the latest ActiveMQ Artemis. It seems to be working properly.
Hi, first of all great work on the library.
I am having trouble with using the library with ActiveMQ for Binary Bodies
I see in Chrome dev tools as the binary frame being sent however nothing is received on activeMQ. I am suspecting that it is activeMQ configuration however all I can find is this:
I tried adding explicitly the content-length but still to no avail. Is there something which I'm missing out?