Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

Fixes #199 #200

Merged
merged 1 commit into from
Oct 22, 2014
Merged

Fixes #199 #200

merged 1 commit into from
Oct 22, 2014

Conversation

simplesmiler
Copy link
Contributor

Fixes #199

Summary:

  • extracted default options and logics for validation and modernization into options module
  • extracted logics for building internal servers (mqtt, mqtts, http, https) into interfaces module
  • server internally uses modernized options
  • if interfaces is not present in options, it's constructed from legacy keys, otherwise left as is
  • if credentials is not present in options, it's constructed from secure, otherwise left as is
  • all conserved options keys are shallow copied

@mcollina
Copy link
Collaborator

This is impressive. I'll review!

var serve = buildServe(iface, mosca);
var server = http.createServer(serve);

mosca.attachHttpServer(server); // REFACTOR?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently offered as a public API. If we want to refactor it, we need to do it providing backward compatibility.
Ideally that belongs on its own file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that this line does not actually belong here, but I was not able to find a better place for it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it does (kind of). You are creating the http server, and you need to add hooks for websockets.

@mcollina
Copy link
Collaborator

Really well written, thanks.

Just one question: should we change the default API? the new mosca.Server() thing it's kind of silly.
How about mosca(options)? Maybe you can add it in here too :).

I would like to have the same style of refactoring for persistence and backend, most of the times you just use Redis or Mongo for both. Does it make sense?

@simplesmiler
Copy link
Contributor Author

To be honest I have no problem with new mosca.Server() :)

Regarding backend and persistence. I'm currently using default option for both, so my opinion on this is kinda worthless. But I think it makes sense to use a single tech for both backend and persistence. Maybe there's even no point in separation between them.

@mcollina
Copy link
Collaborator

Anyway, I'm going to merge this and get it released next week. Would you like to help in fixing the wiki?

mcollina added a commit that referenced this pull request Oct 22, 2014
@mcollina mcollina merged commit b48104f into moscajs:master Oct 22, 2014
@simplesmiler simplesmiler deleted the issue-199 branch October 22, 2014 15:49
@mcollina
Copy link
Collaborator

I've just released 0.26.0 with this fix in! Can you help me updating the docs?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve options
2 participants