Bluetooth in Meteor? - javascript

I'm pretty new to Meteor and web development and such.
My essential question is: is there a 'right' way to communicate with a client's Bluetooth hardware in Meteor/js?
Currently, I'm thinking of writing a driver that takes the Bluetooth data and sends it in a stream to localhost, but that seems a little bit roundabout.

You would have to go via an npm module in Meteor. For this you need to make a package that uses something like bluetooth-serial-port to allow Meteor to communicate with the device using the host device's bluetooth serial port (https://npmjs.org/package/bluetooth-serial-port) (You will need the bluetooth development headers too)
Avital has made a package demonstrating how to use npm modules with meteor : https://github.com/avital/meteor-xml2js-npm-demo

Related

How to give the server port to client

I have a node server with several node projects. I use nginx to get them all responding on port 80. Now, this works for the initial http request. For the websockets, I need to use the direct server port. To keep everything alive while developing I would like to try this, projects will have a dev and live version. Once de dev is stable, I will copy it to the live folder. The live folder is runned by a systemctl script where I define a difrent port to the live version so I can dev without taking the live down. The problem I encounter now is, how can I get the running server port in my client side Javascript so that the dev page connect to the dev port and visa versa?
currently I'm only using express, socket.io and mysql. I have no further npm packages installed. I searched allot but there is not to mush I can find. I found how to connect the socket to the page url but I cannot use that because that URL will always be on port 80. Further I found allot of huge packages that has no use for me since the original page is just static, the dynamics all run over websockets.
Is there any way to parse the port number in the clients .js file like I could do fairly easy in php? And if so, what would be the most efficient way. I could let javascript check if the page uses the live or dev URL but I would prefer not to hardcode my dev URL into JS where it is for everyone to see.
run a third node.js socket.io server program, all your clients connect to this server first.
In this simple node.js program, determine the type of clients by any means. e.g. different user id for dev/production users
send the server url and port to your client according to its type (dev or production)
you may also use this technique to separate your users to different production servers.

Creating a react-native app for IOS and I have created a Microsoft SQL server, how to connect these two?

I have an app built on react native and I want to connect to a database that i have made on the Microsoft SQL server. I have searched online and there are things like myssql but I still get errors with that. I followed this tutorial nodejs from the official Microsoft website, and it works with the nodejs and I use node to run it, but how can i use this in my react native project?
You can use AXIOS to make requests to your NodeJS Server
In Android you can access your localhost by the IP 10.0.2.2 (default proxy configured in your Android Virtual Device).
In iOS you can just use localhost
Remember to add the port assigned your NodeJS Server and the
protocol http
Example URL for Android: http://10.0.2.2:3000
You need to write back-end service code.I suggest you to use Asp.Net Web API .You can use Entity Framework.
Also you can use PHP,Java or Python...

Connect to OpenVPN server through Node.js

I’m trying to create a GUI client for connecting to OpenVPN servers using electron and node but I’m struggling to figure out how to actually connect to the servers using the .ovpn files.
My question is what is the best way to connect to an OpenVPN server using node? Would it be best to Tun terminal commands like
“openvpn—config path to config”
Or is there another way applications like tunnelblick do it that might be easier or more efficient?
Hello I have been working with electron and ovpn on my last project, so here are a few tips.
VPNs require admin/root privilege in order to get setup, so running child_process.spawn on openvpn --config <path> will fail unless your electron app is being ran via sudo/admin privilege.
You can also use electron-sudo package, link here. This is basically a child process spawn with sudo/admin. Aka, app runs normally, but vpn command runs with sudo.
However, if your client is sketchy about giving you sudo/admin, the VPN must be ran separately prior to launching your app.
All in all its a admin/sudo thing.
Hope this helps.

Testing a Single Page Application while simulating the backend

I have a single page application developed using javascript, react and redux that communicates with the backend via web socket, rest and json.
I wish to explore the possibility of working independently of the backend, both as I develop and in terms of treating the front end as a subsystem and performing subsystem tests on it.
Is this a good approach? What tools would you recommend? For example, I have used selenium previously with python. Would it be a sensible option for me to write my own simple test environment using a selenium api where tests are configured in their setup to respond to rest requests from the front end in the appropriate manner. Maybe there are better approaches.
I think npm provide http-server
You can run server in your project dir and it should be server on localhost.
But if you are using Linux or Mac, the easiest way will be:
$ cd you_app_folder
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
As python is built in on mac and Linux it is easiest way as I said.

GraphStream: Interactive Web Application

I'm trying to develop an interactive web application using GraphStream. The idea is to run a couple of community detection algorithms on graphs and visualize them. I wish to use D3.js as graph rendering framework and use GraphStream library in a java websocket server ( Tomcat ) that runs the algorithms. I wish to know if GraphStream already has websocket capabilities that could directly talk to client ( browser ) websocket endpoint. Suggestions for a more correct or feasbile architecture are also welcome.
Great idea. There is a WebSocket implementation that provides GraphStream's event model to the browser. It implements a network protocol, GS-NetStream.
The actual version is compatible with gs-core v1.3.
You can run the exemples from the test/ folder.
In the test folder, run these commands in that order:
Install dependencies : npm install ws express
Compile the Test1.java with gs-core-1.3 in the classpath: javac -cp path/to/gs-core-1.3.jar:. Test1.java
Run the node server : node Test1server.js
Run the Java app :java -cp path/to/gs-core-1.3.jar Test1
go to http://localhost:8080/Test1.html
Use the code in Test1.html as an example for your project

Categories