Mopidy js connect ECONNREFUSED 127.0.0.1:80

I have created a small script that has the purpose to listen to mopidy events and redirect them to a localhost php (laravel) webserver than can handle the events. Maybe I’m getting the whole thing completely wrong…

This is the script I wrote:

const Mopidy = require('mopidy');
var mopidy = new Mopidy();

Now, whenever I do npm start and start my two line script I get a whole bunch of errors:

Mopidy.js is using the default calling convention. The default will change in the future. You should explicitly specify which calling convention you use.
WebSocket error: Event {
  type: 'error',
  message: 'Network error: ws://localhost/mopidy/ws: connect ECONNREFUSED 127.0.0.1:80',
  bubbles: false,
  cancelable: false,
  currentTarget:
   Client {
     url: 'ws://localhost/mopidy/ws',
     _driver:
      Client {
        version: 'hybi-13',
        domain: null,
        _events: [Object],
        _eventsCount: 4,
        _maxListeners: undefined,
        _request: null,
        _reader: [Object],
        _options: [Object],
        _maxLength: 67108863,
        _headers: [Object],
        __queue: [],
        readyState: -1,
        url: 'ws://localhost/mopidy/ws',
        io: [Object],
        messages: [Object],
        _extensions: [Object],
        _stage: 0,
        _masking: true,
        _protocols: [],
        _requireMasking: undefined,

And it gets much longer.

Can you tell me what am I doing here wrong? I am under the impression that I understood this entirely false.

From the docs at https://docs.mopidy.com/en/latest/api/js/#creating-an-instance :

When you instantiate Mopidy() without arguments, it will connect to the WebSocket at /mopidy/ws/ on the current host. Thus, if you don’t host your web client using Mopidy’s web server, or if you use Mopidy.js from a Node.js environment, you’ll need to pass the URL to the WebSocket end point:

The error message states its trying to connect to mopidy at localhost/mopidy/ws. I would guess you don’t have a Mopidy server listening there on port 80. By default it’s at http://localhost:6680/mopidy/ws.