Blockchain Monitoring - Error JavaScript

Hi all thanks for the wonderful support. I need some help with the example code provided in this support article.

Blockchain monitoring

Not to clued up with nodejs inner workings and getting nowhere fast with google searches. Following the instructions we get the following error and can’t figure out why. This is probably more a javascript question.

stomp=require('stompjs');
{ VERSIONS:
   { V1_0: '1.0',
     V1_1: '1.1',
     V1_2: '1.2',
     supportedVersions: [Function: supportedVersions] },
  client: [Function: client],
  over: [Function: over],
  Frame:
   { [Function: Frame]
     sizeOfUTF8: [Function],
     unmarshall: [Function],
     marshall: [Function] },
  setInterval: [Function],
  clearInterval: [Function],
  overTCP: [Function: overTCP],
  overWS: [Function: overWS] }
> stompClient = stomp.overWS('ws://localhost:7778/w/messages/websocket');
Client {
  ws:
   { url: 'ws://localhost:7778/w/messages/websocket',
     send: [Function: send],
     close: [Function: close],
     binaryType: 'arraybuffer' },
  counter: 0,
  connected: false,
  heartbeat: { outgoing: 10000, incoming: 10000 },
  maxWebSocketFrameSize: 16384,
  subscriptions: {} }
> **TypeError: ws.onopen is not a function**

stompClient returns connected: false. Could this be reason for the ws.onopen error?

Anyone? Any idea on where to start trouble shooting the issue?

Sorry I missed this topic :slight_smile:

Did you checked first if all works ok if you using nanowallet with your local node (nanowallet also use websockets)?

You can look at implementation in nem-sdk:

https://github.com/QuantumMechanics/NEM-sdk/blob/master/examples/browser/websockets/script.js (examples in javascript) using this library https://raw.githubusercontent.com/QuantumMechanics/NEM-sdk/master/dist/nem-sdk.js