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

feat(factory): use the factory mode #340

Merged
merged 3 commits into from
Aug 12, 2016
Merged

feat(factory): use the factory mode #340

merged 3 commits into from
Aug 12, 2016

Conversation

daviddias
Copy link
Contributor

No description provided.

case 1: callback(null, apiClients.b); c++; break
case 2: callback(null, apiClients.c); c++; break
default: callback(new Error('no more nodes available'))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is 'hacky' right now.

What I would love to be able to do is to have a an actual spawnNode function, that new if run on the browser or in Node.js and would spawn the node through a Karma service. Essentially, RMI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dignifiedquire does karma offer a way to do this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not without writing a decent amount of code.

Copy link
Contributor

@dignifiedquire dignifiedquire Aug 10, 2016

Choose a reason for hiding this comment

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

What you could do is

  • create a simple socket.io server that can spawn nodes on a specific message (start this one through gulp)
  • in the spawn function, connect to the socket.io server and tell it to spawn a node, and get as a response the needed info, this spawn function would then work in the browser and in node

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

It would be a sweet feature for Karma btw :)

@dignifiedquire
Copy link
Contributor

@diasdavid PRs welcome :)

@daviddias
Copy link
Contributor Author

RFM, needs CR

@daviddias
Copy link
Contributor Author

The CI errors are #339

}

module.exports = (callback) => {
const http = new Hapi.Server(options)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to bring in hapi? just using core-http should be enough for serving socket.io

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 like hapi because then I can just set CORS to true without having to write headers by hand. Also hapi is pretty modular, a lot of features (like template engine) are buy in modules, which makes it a 'smaller' framework

@daviddias
Copy link
Contributor Author

Thank you for CR @dignifiedquire :) merging

@daviddias daviddias merged commit 7dcb3c4 into master Aug 12, 2016
@daviddias daviddias deleted the feat/ipfs-factory branch August 12, 2016 11:22
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.

2 participants