Skip to content

Browserifying and subscriptions #17

@edge0701

Description

@edge0701

I am looking to develop on your excellent work - I am looking to update the version of MQTT.js.
But I am stuck at the first hurdle whilst trying to use browserify to create the bundle. I am missing something to do with the MQEmitter. I get the error:
Error: Cannot find module 'MQEmitter' from '/home/edge/src/polymer/mqtt-wrapper/mqtt-elements'

The workaround I have found so far is to run browserify -r ./node_modules/mqtt/lib/store.js:Store -r mqtt -r ./node_modules/mqemitter/mqemitter.js > dist/mqtt-elements-bundle.js and then change the string in the bundle from ./node_modules/mqemitter/mqemitter.js to MQEmitter.

I have updated mqtt.js to the latest version and all seems to be working...except subscriptions. That is the reason I wanted to try an updated mqtt version.

Publishing works fine, but subscriptions don't seem to work. I am testing with Mosquitto and AWS IoT. Both fail to subscribe. But I do not disconnect from the server. I see the binary frames sent in Chrome browser debugger. I am using your example code "injecting-mqtt-connection". I see no messages and {{item.subscribed}} remains false.

Any help would be appreciated for A) how to browserify correctly, and B) why subscriptions don't work for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions