Thursday, 2 January 2020

TypeError: instance[method].bind is not a function AdonisJs

I am integrating MQTT-adonis module adonis-mqtt respo on git here in adonis-js application while serving it throws an exception

TypeError: instance[method].bind is not a function

Can any one guide why this is appearing.

//event.js

'use strict'
 const Event = use('Event');
const Mqtt = use('Mqtt');
// Listen to some Events of the library
Event.on('MQTT:Connected', 'Message.subscription')
Event.on('MQTT:Disconnected', 'Message.disconnected')

//Listeners/Message.js

class Message extends MqttListener {

get subscription () {
return 'Topic/Info'
 }

async handleMessage (message, wildcardMatches) {
  }

it appears that it is throwing exception here in this block

//node_modules/adonis-mqtt/Mqtt/Mqtt.js

this.client.on('connect', this._handleConnect.bind(this)) //here at this line
    this.client.on('offline', this._handleDisconnect.bind(this))
    this.client.on('close', this._handleDisconnect.bind(this))
    this.client.on('end', this._handleDisconnect.bind(this))
    this.client.on('message', this._handleMessage.bind(this))


from TypeError: instance[method].bind is not a function AdonisJs

No comments:

Post a Comment