webRTC in node.js - node.js

I'd like to use webRTC in node.js to manage mixed connections involving peer on browser and nodejs.
I did some tests and searches, I tried using wrtc or webrtc-native but in both cases I can't get them works getting builded binaries or rebuild them (tried on Debian 8, Ubuntu 14 and 16). It also seems the projects are discontinued and I found only articles having 2-3 years old.
I'm looking for advices about modules or libraries to use, or how to make wrtc or webrtc-native works.

NodeJs a simple mesh type media network.
express module - web server to serve your html client
socket.io - Signalling server to exchange SDP and ICE candidates
Refer WebRTC-Example, webrtc-group-chat-example to write your own client and server model
Kurento standalone server (MCU media network) not in Node but has an npm module for client side
Refer Kurento
NodeJS MediaSoup SFU media network
Not sure of client model but refer MediaSoup API

A lot of nodejs libs exists for webrtc. but they share one problem ... webrtc.node sometimes does not work on your machine and you have to recompile one for yourself to use.
I made a module that is a compination of other modules. The module is mainly the code of webrtc-native but the webrtc.node binary is built using script used in node-webrtc. That was useful to be as node-webrtc uses build-webrtc to compile the code and extract headers, and I find this handy.
It compiles and builds straight forward.... make sure you check the readme to find the tricks.

I discovered wrtc version 0.0.60 it's ok, so just use that version and webRTC on node.js works

Related

Using RFID Reader on Node JS

I'm working for a public library in my town, and I have developed a web application to handle the borrowing process and other administration problem. A few years ago, the library bought and attached the books in the library with a RFID tag, and with it, also bought a RFID Reader to be used in the borrowing process, and a RFID Sensor Security Gate, to prevent the books from being taken out without proper administration process. For the RFID Reader to be used, the vendor gave me a JAVA applet to connect the RFID Reader to my web application, as it's not possible to access a device from the web with just Javascript or JQuery.
Currently, the library is asking me to develop a kiosk application for the library's self service center. I currently developing the kiosk application with Node JS, and I managed to create the user and password authentication with native Javascript and AJAX function.
However, problem occured when I tried to use the RFID Reader to detect the books. I tried using some modules called node-hid, but everytime I run the application, it gave me an error message.
I used:
Windows 10
Node v10.16.3
npm v6.9.2
Electron v5.0.6
Some poeple in the forums recommended to rebuild and reinstall the module and the node, but it's not working for me. Others told me to downgraded the Node or the npm using nvm, but from what i read, nvm only worked for Linux. Honestly, I'm still new in Node JS, and I'm a little bit confused: regarding the error message above, which one is actually the problem? The Node version, or the npm version?
Struggling, I tried to forget about using modules about RFID, and start from the scratch by detecting devices connected on USB first, so I use serialport module, but the same error persist.
I expected to be able to read the books' ID from the RFID tag, and rewrite some blocks in it to prevent the alarms from the RFID Sensor Security Gate goes off.
Any supports regarding the error above, or a recommendations to use another module will be appreciated. I'm at the end of my rope here.
I know this is a bit late but I'm putting it here just in case someone passed by it.
You are getting this error because you are using a native module which is ok for node, but because electron is a modified node, so in order for thhat to work: you need to rebuild for electron instead:
Add the electron-rebuild package
npm i -D electron-rebuild
Remove the node-modules folder, as well as the packages-lock.json file.
Run npm install to install all modules.
Run ./node_modules/.bin/electron-rebuild or .\node_modules\.bin\electron-rebuild.cmd for Windows to rebuild everything.

Can I run VueJS and NodeJS or related apps on Server that doesn't have NodeJS installed?

So I'm new to Vuejs and doesn't know anything about npm, node, and other javascript apps.
I wanted to switch to VueJS so that I can take away from JQuery. Been using AdminLTE for my projects before.
I wanted to use vue-admin now since it seems to address all of my needs. However, I have specific work area situations that seems to hinder learning Vue and other JS apps, these are:
The workspace folder (development) where I'm creating applications is hosted in the production server (Windows Server).
I think NodeJS isn't installed in the server
Adobe Coldfusion is used. I don't have a local server, so the production server is used when developing.
Question:
Will the production server run the app built with vue-admin even if the production server doesn't have NodeJS installed? (I have NodeJS locally).
I need to use Coldfusion for the logic of the application, specifically I'm using CFWheels right now and vue-admin for Frontend and UX. Is it possible? The application I'm making is closely related to parts of an ERP system.
Any pointers on how I could do this?
Yes you can. Most likely you will need NodeJS locally to make your development life a bit easier.
You can simply include Vue in your project with a script tag or your can use a buildtool like Webpack to enable you to write ES6 and use a module system.
If you go with the latter it still exports as plain ES5 allowing you to use it on your server without any problem since all of this is code which runs on the clients machine, not on your server.
As you can see the requirements for this project have a big bold headline with: 'Development'.
https://github.com/vue-bulma/vue-admin#development
You don't need any of the requirements in production.

Angular2 working with NodeJs

My understanding is that AngularJS including Angular2 is a client-side framework, while Node.JS is a server side platform. They should not cross. But all Angular2 tutorials I found use Node/NPM. Why is that?
Because npm is a package manager for packages written in JavaScript, and JavaScript can run both on client and server side. In other words, frontend and backend applications can both benefit from packages. Many development tools also use node as an underlying process (e.g. Jest-cli).
I would suggest you to use angular2 only on client side. The performance of angular2 really shines when it comes to handling view containers over regular server side codes. On the NodeJS side, I would recommend using es6 features. Which has revolutionised how you can not only code, but also performance.
The reason you see most tutorials using npm is because they are either using TypeScript or a build tool that uses Node to convert to ES5 or build your project.
However you can still build Angular2 apps using the sfx version (self-executing bundle) of Angular2 and using ES5 syntaxes without having to use node or npm. Here is a blog post that shows how to do that
http://blog.thoughtram.io/angular/2015/05/09/writing-angular-2-code-in-es5.html
Angular2 is a front-end framework but a lot of tooling that assists in building Angular2 applications are available via NPM.
If you want a package manager that's geared specifically to front-end development I suggest JSPM. It supports front-end modules of various formats (ie AMD, CommonJS, UMD), handles transpiling out of the box, and can be used as a build tool to concatenate/minify your application code.
You'll still need NPM for many other utilities and you'll need a back-end server for testing (I recommend live-server).
As far as the back-end is concerned. One of the Angular2 dev teams is working on a Node/Express extension that supports isomorphic rendering of JS. In short, it pre-renders the view on the server so the user can interact with it in the browser while the app loads in the background. The start time of launching a fully-featured SPA will still be kind of slow (relatively) but perceived speed will be instantaneous.

Angular application requred node.js

I am going to create my first angular application. I have read lots of angular tutorial and many of them mentioned node.js.I am really got confused here.
Do we really need to install node.js and other dependencies to run angular application ?
Can't I just add respective angular libraries in my eclipse and create Angular application?
What are advantages of using node.js?
Also it is necessary to add all angular code is under App folder?
Regards,
Dip
As it is said on note.js website
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
So it depends if you want to have server logic (services) or not. If you are creating just the UI of the app you don't need note.js. Also Angular is NOT dependable on note.js

Can't access socket.io

this might be a bit of a silly question but it's something that i've been struggling to find the answer to and for some reason it doesn't seem to be evident from the tutorials and websites i have been reading, so maybe it's something that is assumed that i'm really missing.
So anyway, i installed node.js and then used the command npm install socket.io. it them proceeds to download and install a bunch of files, i don't see any error with this process in the command line.
So now i've tried to access socket.io like this:
<script src="/socket.io/socket.io.js"></script>
Like it shows on the socket.io website, however i get an error saying the file isn't found..... my first guess is that the installation of node.js and stocket.io are both on the local machine (program files) and not in the htdocs.
I have tested this one two platforms, first was my localhost which is Windows 7 running XAMPP on it, and i installed node.js and stocket.io globally (Program files). Second was my Windows server that uses IIS still get the error.
So my question is, how do i reference the stocket.io API and start using it based on the installations i have?
Thanks for your time.
npm isntall socket.io installs Socket.IO in a local node_modules folder so that the library is accessible to you in your own Node.js applications. You still need to create (and run) a Node.js application that loads up the module and sets up an HTTP server that uses the module; the examples under How to use in the project readme is a good starting point, although preexisting knowledge of Node.js will be helpful. You might check out Node.js Tutorial with Socket.IO if you're looking for additional information.

Resources