Websocket Broadcast from ACE Command


I checked this example Broadcast from anywhere but i did not get it to work.

This worked from a normal http Controller.

But if i try to use this in a Command Class (App->Command->MyClass.js)
It does’nt work.

Problem is, that broadcast is every time null!

Does anyone have a tip for me what I’m doing wrong?

Here is my Class:

const _ = require('lodash')
const Ws = use('Ws')

class MyClass extends Command {
  static get signature () {
    return `
    MyClass functions
    { --test: test }

  static get description () {
    return 'MyClass functions'

  async handle (args, options) {
    this.info(`  ${this.icon('info')} Command: MyClass...`)

    let value = _.keys(_.pickBy(options, _.isBoolean))
    switch (value[0]) {
      // test arg
      case 'test':
          this.info(`${this.icon('info')} Command with flag: --test`)

          Ws.getChannel('chat').topic('chat').broadcast('message', {
            username: ' - Servernachricht',
            text: 'Auswertung startet'

          this.info(`  ${this.icon('info')} Command with wrong options.`)
    } // of switch
    this.info('----------- ende / finish -----------')

  } // of handle
} // of class


same issue but I found it work in http controller.