Comments (7)
I have not tested binary messages with ActiveMQ. I will setup a broker and test in the coming week.
from stompjs.
I tried couple of different ways, so far no success. If you figure out something please let me know.
from stompjs.
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.
from stompjs.
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.
from stompjs.
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.
from stompjs.
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.
from stompjs.
I have tested with the latest ActiveMQ Artemis. It seems to be working properly.
from stompjs.
Related Issues (20)
- Failed to compile HOT 8
- Still seeing retry after a successful connection. HOT 1
- Cant receive data from websocket
- ws does not work in the browser. Browser clients must use the native WebSocket HOT 2
- TypeScript 5 claims IStompSocketMessageEvent and MessageEvent are incompatible HOT 3
- .
- Callback when a heartbeat has come or gone
- Pinging on demand HOT 1
- Connection closed when App is killed on Android HOT 1
- react native error: trust anchor for certification path not found, when trying stomp socket connection , i used @stomp/stompjs lib. any way to ignore sign certificate? HOT 1
- One and the same message is perceived as 2, with different ID but with the difference of one number at the end. HOT 3
- How to add httpOnly cookies to connectHeaders HOT 3
- Send a JSON object to the body when publishing HOT 1
- TypeError: WebSocket is not a constructor HOT 1
- Stomp auto make new connect after about 1 minute. HOT 1
- Rx-Stomp Invalid frame header Error
- Connection keep closing on React Native HOT 1
- Not working in React Native HOT 1
- Not compatible with Closure Compiler HOT 1
- STOMP redelivery policy on SUBSCRIBE doesn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stompjs.