Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Commit 2abf0aa

Browse files
committed
wip
1 parent 248f2ee commit 2abf0aa

File tree

8 files changed

+32
-14
lines changed

8 files changed

+32
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ npm-debug.log
1414
tags
1515
cpplint.py
1616
generated
17+
package-lock.json

examples/html/client.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
});
3737

3838
// Create a connection to the rosbridge WebSocket server.
39-
ros.connect('ws://localhost:9090');
39+
if (window.location.protocol == "https:") {
40+
var ws_scheme = "wss://";
41+
} else {
42+
var ws_scheme = "ws://"
43+
};
44+
ros.connect(ws_scheme + window.location.hostname + ':9090');
4045

4146
// Create a Service client with details of the service's name and service type.
4247
var addTwoInts = new ROSLIB.Service({

examples/html/publisher.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
});
3737

3838
// Create a connection to the rosbridge WebSocket server.
39-
ros.connect('ws://localhost:9090');
39+
if (window.location.protocol == "https:") {
40+
var ws_scheme = "wss://";
41+
} else {
42+
var ws_scheme = "ws://"
43+
};
44+
ros.connect(ws_scheme + window.location.hostname + ':9090');
4045

4146
// Publish a Topic
4247
var example = new ROSLIB.Topic({

examples/html/service.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
});
3737

3838
// Create a connection to the rosbridge WebSocket server.
39-
ros.connect('ws://localhost:9090');
39+
if (window.location.protocol == "https:") {
40+
var ws_scheme = "wss://";
41+
} else {
42+
var ws_scheme = "ws://"
43+
};
44+
ros.connect(ws_scheme + window.location.hostname + ':9090');
4045

4146
// Create a Service client with details of the service's name and service type.
4247
var addTwoInts = new ROSLIB.Service({

examples/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
const express = require('express');
1818
const app = express();
1919

20-
app.use(express.static('.'));
20+
app.use(express.static('html'));
2121

22-
app.listen(3000);
23-
console.log('The web server started on http://localhost:3000');
22+
app.listen(3000, '0.0.0.0');
23+
console.log('The web server started on http://0.0.0.0:3000');

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ function createServer(options) {
5555
debug('Application will exit.');
5656
shutDown();
5757
});
58+
process.on('SIGINT', process.exit);
59+
5860
return rclnodejs.init()
5961
.then(() => {
6062
node = rclnodejs.createNode('ros2_web_bridge');

lib/bridge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
const ResourceProvider = require('./resource_provider.js');
1818
const debug = require('debug')('ros2-web-bridge:Bridge');
1919
const EventEmitter = require('events');
20-
const uuidv4 = require('uuid/v4');
20+
const { v4: uuidv4 } = require('uuid');
2121
const {validator} = require('rclnodejs');
2222

2323
const STATUS_LEVELS = ['error', 'warning', 'info', 'none'];

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@
3333
],
3434
"devDependencies": {
3535
"async": "^3.2.0",
36-
"express": "^4.16.2",
3736
"eslint": "^6.8.0",
37+
"express": "^4.17.1",
3838
"js-sha512": "^0.8.0",
39-
"mocha": "^7.1.1",
4039
"jsdom": "^16.2.1",
40+
"mocha": "^7.1.1",
4141
"puppeteer": "^2.1.1"
4242
},
4343
"dependencies": {
44-
"commander": "^5.0.0",
45-
"debug": "^4.1.1",
46-
"rclnodejs": "^0.x.1",
47-
"uuid": "^7.0.2",
48-
"ws": "^7.1.1"
44+
"commander": "^6.2.1",
45+
"debug": "^4.3.1",
46+
"rclnodejs": "^0.17.0",
47+
"uuid": "^8.3.2",
48+
"ws": "^7.4.1"
4949
}
5050
}

0 commit comments

Comments
 (0)