Skip to content

Commit 48a5f85

Browse files
author
Stefania
authored
Merge pull request #1 from arduino/gvarisco-patch-1
Fixed prod link for Create
2 parents e450dbd + b39af5a commit 48a5f85

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ $ npm install arduino-iot-js
1616
import ArduinoCloud from 'arduino-iot-js';
1717

1818
// connect establishes a connection with mqtt, using token as the password
19-
// Development Vernemq server host is wss.iot.oniudra.cc port 8443, token is your Hydra bearer token
2019
// options = {
21-
// host: 'BROKER_URL', // Default is wss.iot.oniudra.cc
20+
// host: 'BROKER_URL', // Default is wss.iot.arduino.cc
2221
// port: BROKER_PORT, // Default is 8443
2322
// ssl: true/false, // Default is true
24-
// env: 'dev', // Api env, default is dev (for now!)
2523
// token: 'YOUR_BEARER_TOKEN' // Required!
26-
// apiUrl: 'AUTH SERVER URL', // https://auth-dev.arduino.cc for dev
24+
// apiUrl: 'AUTH SERVER URL', // Default is https://auth.arduino.cc
2725
// onDisconnect: message => { /* Disconnection callback */ }
2826
// }
2927
ArduinoCloud.connect(options).then(connectionId => {
@@ -74,7 +72,7 @@ ArduinoCloud.onPropertyValue(connectionId, deviceId, propertyName, updateCb).the
7472
```
7573

7674
## Run tests
77-
First of all you need a valid Hydra Arduino token, you can get it from [Create Cloud Dev](https://create-dev.arduino.cc/cloud/)
75+
First of all you need a valid Hydra Arduino token, you can get it from [Arduino Create IoT Cloud](https://create.arduino.cc/cloud/)
7876

7977
Then you can use this token to run tests
8078

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "arduino-iot-js",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"license": "GPLv3",
55
"description": "JS module providing Arduino Create Cloud Connection",
66
"main": "./src/index.js",

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import ArduinoCloudError from './ArduinoCloudError';
2626
const connections = {};
2727
const propertyCallback = {};
2828
const arduinoCloudPort = 8443;
29+
const arduinoCloudHost = 'wss.iot.arduino.cc';
30+
const arduinoAuthURL = 'https://auth.arduino.cc';
2931

3032
const getUserId = (apiUrl, token) => fetch(apiUrl, {
3133
method: 'get',
@@ -44,9 +46,9 @@ const connect = options => new Promise((resolve, reject) => {
4446
ssl = true;
4547
}
4648
const opts = {
47-
host: options.host,
49+
host: options.host || arduinoCloudHost,
4850
port: options.port || arduinoCloudPort,
49-
apiUrl: options.apiUrl,
51+
apiUrl: options.apiUrl || arduinoAuthURL,
5052
ssl,
5153
token: options.token,
5254
onDisconnect: options.onDisconnect,

test/arduino-cloud.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ it('ArduinoCloud connection', () => {
3838
/* global token */
3939
return ArduinoCloud.connect({
4040
token,
41-
apiUrl: 'https://auth-dev.arduino.cc',
42-
host: 'wss.iot.oniudra.cc',
4341
onDisconnect: (message) => {
44-
// return ArduinoCloud.connect({host: 'localhost',
45-
// port: 8080, ssl: false, env: 'dev', token, onDisconnect: message => {
4642
if (message.errorCode !== 0) {
4743
throw Error(message);
4844
}

0 commit comments

Comments
 (0)