Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support URI connections #164

Closed
wolfeidau opened this issue Mar 16, 2014 · 5 comments · Fixed by #165
Closed

Support URI connections #164

wolfeidau opened this issue Mar 16, 2014 · 5 comments · Fixed by #165

Comments

@wolfeidau
Copy link
Contributor

The client does not seem to support URI connections, while there is no common MQTT URI scheme, supporting mqtt://, mqtts:// and tcp:// URI's would make it easier to
use this client in heroku and other PaaS environments.

Any thoughts on this?

See njh/ruby-mqtt#31 for previous discussions on this.

@mcollina
Copy link
Member

I would like to get some feedback from @knolleary and @ralight on the URL
format.
Actually I have implemented it a few times myself so it makes complete
sense to have it in here.

The main thing we are missing is a new 'createClient' interface that can
handle both normal and encrypted, with an object-based parameters (not
positional).

@wolfeidau
Copy link
Contributor Author

Yeah I would encourage you to consider moving to something like.

var mqtt = require('mqtt')

// either mqtt:// or tcp://
client = mqtt.connect('mqtt://guest:guest@localhost');

With an options argument available to support extra params for things like TLS related params.

var mqtt = require('mqtt')

var options = {
  rejectUnauthorized : true, 
};

// either mqtts:// or ssl:// 
client = mqtt.connect('mqtts://guest:guest@localhost', options);

This would avoid breaking the existing code while offering a nice clean interface for connecting using a URI.

@knolleary
Copy link
Member

@mcollina this was discussed recently on the MQTT mailing list. A summary of the discussion was put on the wiki here.

The piece that is missing is how to specify the client-id in the uri. The only place for it is as a ?clientId= style parameter, which doesn't look elegant to me...

Admittedly this is all informal - I will bring it up on the OASIS list for discussion to see if we can get something added in time for the 3.1.1 doc.

@knolleary
Copy link
Member

Have raised an issue against 3.1.1 - https://tools.oasis-open.org/issues/browse/MQTT-203

wolfeidau added a commit to wolfeidau/MQTT.js that referenced this issue Mar 18, 2014
wolfeidau added a commit to wolfeidau/MQTT.js that referenced this issue Mar 18, 2014
@mcollina
Copy link
Member

@knolleary do you think the clean flag should be in the URI, in the same way client id is specified?

mcollina added a commit that referenced this issue Mar 19, 2014
Added connect method which accepts a URI see #164.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants