How to use nodejs with ROS - javascript

I have a project where I have users on the backend and I have go-karts run by rosbag which in turn is on the frontend. I want to put my topics in a database but I have no idea what it could be, that's when I found the rosnodejs option. Can anyone help me with how ROS works with nodejs? I can't find one on the internet that is connected to port 9090, which works by default.

Related

How to create a chat usable from differents computers in node.js?

I am currently learning node.js and I've just finished the chat using socket.io and express.js which works well. But now I'd like to expand this chat so that two users from differents computers could communicate.
I think it might be easier, first, using two computers on the same network but then I'd like the app to enable communication between two computers (each on a different network).
Is it possible using socket.io ? If yes, how ?
I guess there's something to change here :
server.listen(8080, function(){
console.log('listening on *:8080');
});
If someone knows how, please let me know !
Thanks
You'll need to host your nodeJS application to a web server, giving everyone access to your website.
To achieve that you will need to use Cloud Application Platform, like AmazonWebService, or Heroku. You will be able to host your nodeJS application to a server same as you do to develop but it will be online.
You could follow theses tutorials :
https://devcenter.heroku.com/articles/node-websockets
https://hackernoon.com/deploying-a-node-app-on-amazon-ec2-d2fb9a6757eb
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
You can found more with this google search :
"deploy node js app nginx"
Good luck.

Cannot find jquery.couch.js

I am trying to get started using couchDB. While standing up a cluster of three docker containers is easy enough using this GitHub repo, I cannot create a javascript program to query the database.
All the guides I find say the required libraries live at:
http://127.0.0.1:15984/_utils/script/jquery.couch.js
and
http://127.0.0.1:15984/_utils/script/jquery.js
However, when I try to run this, I keep getting a not found response. What am I doing wrong?
Note:
I know normally the port is 5984 but with my docker cluster 15984
is the correct choice
Going to localhost:15984/_utils, localhost:25984/_utils, and localhost:35984/_utils takes me to the CouchDB interface.
I cannot connect to the couchdb using the container's IP addresses
I can also use 172.17.0.1 in place of localhost

Electron SQL security

I have a rather noob question that I can't seem to find the answer for. So I've heard that all electron apps can be turned into source code and then manipulated. So that leads me to my next question. If I'm connecting to a SQL database then what is keeping people from viewing source code, going in and doing whatever they want to the db? I mean once they see the source code the username and password are right there...Sorry if this is a silly question but I'm thinking of making something on electron that needs decent security. I've also heard php cannot be used. So... Any suggestions would be appreciated. I'm just wondering because Discord, whatsapp and such seem to do it somehow, but how?
Thanks!
Well, any information in any application can be reverse engineered, so I would suggest to not hardcode database passwords or any other critical credentials.
I assume Slack, Discord and others don't hardcode their DB passwords in app. Their desktop app don't "talk" directly to database, it's talking with some server-side application. You as a user have to provide credentials to your account. Communication is done through API which implies various restrictions based on your user privileges. This server-side application decides what you can and what you cannot do and translates your requests into DB operations.
So using those apps you don't go even near to their DB passwords.
If you want to do client application which should be able to do some operations on DB, I would suggest the same, split this application into two parts: ClientApp and ServerApp.

How to list peers to be connected to video chat on PEERJS and Angular 4?

I've followed the tutorial over building video chat with usage of PeerJs and Angular 4 (http://tphangout.com/angular-2-videochat-using-peerjs/)
Tutorial descibes it for ANg2 , but i was able to launch it with Ang 4
I plan to have a user, which sees the list of other others and can connect to any of them.
Decided to check if someone done this and might advise on following:
1) What is the best way to list users connected to Peer Server? Can this be done with some query ?
2) How to refresh the list if other users are available or disconnected?
So far, easiest way for me would be to store id of connected users in DB and query upon user visiting specific route.
ANy suggestions?
PeerJS is quite outdated, lib wasnt renewed for quite long. Ive researched and there are other options like simplewebrtc (works in chrome, ios etc) , easyrtc and others. The problem is that for those libraries there are no demo projects with Angular 2/4.
Thanks and Regards
You should save the peerjs id's to a database table, and then each client can show a list of them.
Have a look at https://github.com/mikkelking/meteor-video-call
Which is written in Meteor and Angular1.5 - it's really easy to run up, just follow the instructions (install Meteor first). It uses Meteor's reactive database to do live updates of the web pages. It uses the public peerjs server, and will only work on localhost - use Firefox for one end and Chrome for the other end of the video call.
You can ask more me questions if you want.

Send message to thin clients trough angularJS

I have a web application developed with angularJS. There is a form where workplace accidents are saved to the database. When a new record is saved I need to send information to all the computers on the network. Most of them are thin clients related to a terminal server. My web application won't be running ot the clients. Only an alert/message should be shown there, like "New accident was recorded.".
I couldn't find which technology should I use. Any suggestions please?
Thank you in advance!
Regards
There has to be server part of the application that takes care of saving data to database. In that function which saves data, at the end you could create a mailing list of target users (or predefined group of receivers) and create a mail that will be sent with message you want em to receive.
Popping message boxes on network computers is far from any practical solution.
So you don't need any special technology, you already have all you need.
Thanks for the answer Mladen!
I already have a function sending mail to some predefined users. But there are a lot of client machines in which can't send/receive mails... So I have to warn them in some other way.
I'm researching now node.js child_process spawn in order to run command prompt. But couldn't figure out yet how to use node.js.
Thank you again!
Edit: For those who search a similar solution:
With the following line I managed to pop up a message on my computer from javaScript:
java.lang.Runtime.getRuntime().exec("cmd /c msg userID msg_text");
But that is not exactly what I need. I will write here again when I find the solution.

Categories

Resources