Giter VIP home page Giter VIP logo

Comments (7)

kum-deepak avatar kum-deepak commented on September 24, 2024 1

I have not tested binary messages with ActiveMQ. I will setup a broker and test in the coming week.

from stompjs.

kum-deepak avatar kum-deepak commented on September 24, 2024

I tried couple of different ways, so far no success. If you figure out something please let me know.

from stompjs.

azriel46d avatar azriel46d commented on September 24, 2024

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.

kum-deepak avatar kum-deepak commented on September 24, 2024

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.

kum-deepak avatar kum-deepak commented on September 24, 2024

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.

parmy avatar parmy commented on September 24, 2024

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.

kum-deepak avatar kum-deepak commented on September 24, 2024

I have tested with the latest ActiveMQ Artemis. It seems to be working properly.

from stompjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.