Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I need to use nodejs to run a stomp client for javascript and send stomp message over websocket.

I have a js file send.js:

var Stomp = require('stompjs');
var client = Stomp.overWS('ws://localhost:61614');

I ran node send.js in command line but got below errors:

/xxx/node_modules/stompjs/lib/stomp-node.js:71 ws.onopen(); TypeError: ws.onopen is not a function at WebSocketClient. (/xxx/node_modules/stompjs/lib/stomp-node.js:71:10) at WebSocketClient.emit (events.js:180:13) at WebSocketClient.succeedHandshake (/xxx/node_modules/websocket/lib/WebSocketClient.js:335:10) at WebSocketClient.validateHandshake (/xxx/node_modules/websocket/lib/WebSocketClient.js:319:10) at ClientRequest.handleRequestUpgrade (/xxx/node_modules/websocket/lib/WebSocketClient.js:248:14) at ClientRequest.emit (events.js:180:13) at Socket.socketOnData (_http_client.js:476:11) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:269:12) at readableAddChunk (_stream_readable.js:256:11)

Why? How can I correct this?

stompjs links to this Github page which states that "This project is no longer maintained".

It was last updated about 4 years ago.

I think you should consider a more up-to-date alternative like @stomp/stompjs

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.