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

Connection enhancements #70

Merged
merged 5 commits into from
Dec 17, 2015

Conversation

BrianGenisio
Copy link
Contributor

Implements #69 and #67.

Gives two optional ways to connect to the Particle:

By Name

var byName = new Particle({
  token: process.env.PARTICLE_TOKEN,
  deviceName: process.env.PARTICLE_DEVICE_NAME || "crazy_pickle"
});

By Host/Port

var byIp = new Particle({
  host: '192.168.0.111',
  port: 48879
});

The existing mechanism (deviceId) still works:

var byId = new Particle({
  token: process.env.PARTICLE_TOKEN,
  deviceId: process.env.PARTICLE_DEVICE_ID
});

@rwaldron
Copy link
Owner

rwaldron commented Dec 9, 2015

Will review tomorrow

return Promise.reject("Unable to find device " + deviceName);
}
});
}
Copy link
Owner

Choose a reason for hiding this comment

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

General note about naming things that wrap Promises: "get", in JS programming terms, implies a synchronous operation, deriving meaning from the spec's [[Get]](o, p), Get(o, p), etc. The word "fetch" better describes what these functions are doing, so should be named fetchJson, fetchDeviceId and so on

@BrianGenisio
Copy link
Contributor Author

@rwaldron Thanks for the review. Fixed.

rwaldron added a commit that referenced this pull request Dec 17, 2015
@rwaldron rwaldron merged commit 03dd45b into rwaldron:master Dec 17, 2015
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 this pull request may close these issues.

2 participants