Do I need to rewrite my client library in Javascript? - javascript

For my IOS Application, the client interacts with the server through a fairly substantial client library in C. I am recreating the app on a website, and I was wondering if I needed to rewrite this library in javascript. Would it be possible to say, transfer the original static client library to the client through local storage and somehow execute it? Or to download it as a plugin (how would I do this)? This is just speculation. Any ideas for a possible solution would be very helpful. It needs to be client-side because it streams and decodes a video feed through tcp.
Thanks in advance

As you iOS application uses a library in C the only way (somewhat experimental) is to use Google Native Client which is a sandboxing technology for running a subset of Intel x86 or ARM native code safely from a web browser. But by now it is only available on Chrome.
Otherwise you have to write it in Javascript in order to be cross platform and run it from nearly every web browsers. Moreover you can modify our iOS application and make it hybrid, and then you can use the same Javascript library in your iOS application and in the client web browser.

Related

Is it possible to write a web server running in a modern browser such as Chrome, Firefox, IE, Safari?

In the Substratum Initial Coin Offering (ICO), the White Paper talks about solving problems of the current Internet, by allowing hosts to become web hosts.
Based on reading of the White Paper, the team looks like they're intending to write Javascript that runs on any modern browser (IE, Safari, Chrome, Firefox) on any platform (Windows, Linux, etc) to turn it into a web server.
As the White Paper is very general, I'm not sure if the team's Javascript is also having some form of access to uPnP technology that tells the nearest router to forward port 80 into the (supposed) web browser that's running on the web server.
Does anyone familiar with current web browsers know if browsers are capable of:
Providing access to uPnP that can tell routers to do port forwarding?
Running a web server using Javascript?
Thank you. (I'm familiar with general programming, just not capabilities of current web browsers. Please limit responses to capabilities of web browsers)
There are some JavaScript libraries such as nohost that use Service Workers to mimic a file server on the client-side. This is apparently possible because service workers are able to send custom responses to HTTP requests.
It might also be possible to run a server in a browser in an x86 emulator in JavaScript, though I don't know if this has been done yet.

Real-time streaming from Android camera to browser

We are working on an IP camera Android app that should stream the video took in real-time by the Android camera to a Web page served by the same app and accessed through WiFi only.
The app currently use a pseudo-streaming method (an image sent using HTTP with no-store), but it is not robust enough, so we need to change it for a better streaming method. We also need to support multicast (or at least an optimized "multi-unicast"), and if possible use an UDP protocol (or at least a low-latency TCP protocol).
We cannot use any intermediary server (so no Wowza or the like, unless it is also served by the app) or any browser plugin (so no VLC or the like, unless it is served by the app too). The main browser it is used on is Chromium.
We searched for and tried a lot of methods but none worked for us :
WebRTC sounds cool, but it uses an intermediary signaling server, it doesn't support multicast, and it is kind of heavy for what we want
RTSP with libstreaming sounds cool too, but no browser seems to implement it, and we couldn't find a Javascript library to do it.
RTMP works on most browsers, but we could'nt find a working Android library
Which streaming method would be best for our needs, and do you know Javascript and Android libraries implementing them ?
There is no way to stream multicast to a browser.

Using a scanner connected to a pc in a web application using php,javascript

How can I use a scanner connected to pc in a web page i'm created using php and javascript
Javascript only interacts with your browser, i don't now if is possible that your scanner act as a WebCam, in this case you can use HTML5 api for webcam
Php or any server-side language is able to interact with the server and run commands , so is posible in someways if your scanner device has some command-line way to scan , but keep in mind this will only work with an scanner attached to the server where this script is host, this probably works for you if you are planning to create this for a home network o company network, mostly like a Web GUI for the "home/company" scanner
if you are thinking to do it to scanning app to the "world", They only way i can think you are able to do it, is probably creating a Java Applet , but nowadays is very common that web browser block java applets
This is not possible directly with JS or PHP, but you can try scanner.js
click here for demo and documentation
Edit:PDF Document for Scanner.js . Just include .js and using javascript callback functions to perform action.

Creating Desktop applications that run on web browser

In the last year I got to know that many developers started developing desktop applications that run on the web browser.
I am also trying to get into it and I'm trying to understand how I should start with such kind of development.
I first thought I should create a regular client-server application, i.e. with Apache Tomcat or with PHP, and for each launch of an application, to launch a new server on localhost and to open a browser that will load the application.
I've lately got to know that there are packages that do the server-client work for you, such as node-webkit.
I don't know where to start and I'm very confused...
When developers say that they develop desktop applications in Javascript or such that run on web browser - do they probably mean that the use node-webkit? Or does they do the complex structure I described above (JSP/PHP server on localhost) ?
Many development models with web technologies exist, but they have different purposes and it all depends on what you want to do.
You seem to be mixing 3 models
Classic websites
A server (with PHP, Java or whatever) generates HTML.
A user uses a browser to access it.
When the user clicks somewhere, the server is called again and generates another HTML file.
Single Page Applications
This model is often used when writing websites that need a lot of interactivity. For example Gmail, or Google docs are SPAs (more or less).
SPAs are websites (you can access them at an URL) where all templating is done client side, and the webserver only exposes a HTTP API.
Most of the times, people use frameworks to make those like:
AngularJS
React
Backbone
Desktop apps with web technologies
That's just coding an application that you can install on a computer or phone with web technologies (javascript, css, html).
There is no server.
Tools that enable programmers to do this are
Node webkit (for desktops)
Cordova (for phones)
Many others
Most of the time, programmers also use SPA tools in conjonction with those to help them during development
The selection of technologies for building an application depends on the use of your application and the platform you want it to run on.
Web applications in contrast to Desktop applications are hosted and served by servers (like Tomcat) which are then requested and present to you by your browser.
Desktop applications are running on your local machine and they are independent from your browser. However node webkit, allows you to design applications using HTML and making them dynamic using node. The end result is a standalone application that runs as a browser emulation that is able to render and run software based on HTML and javascript. (In this case nodejs serves the application locally and the standalone web-app is the client).
Long story short node-webkit emulates the client-server model that is used for classic web apps, to build desktop applications.
It is an unorthodox way for doing things IMHO, but it might be a good start for getting into application development.
Try this-
https://electronjs.org/
Build cross platform desktop apps with JavaScript, HTML, and CSS. With Electron, creating a desktop application for your company or idea is easy. Initially developed for GitHub's Atom editor, Electron has since been used to create applications by companies like Microsoft, Facebook, Slack, and Docker.

Websocket server and Mobile clients

I have a Tomcat based server which serves as a Websocket end point (used javax.websocket) for my web based JS app. I am serving out json based data (queried from my database) via the web sockets. I am not using websockets to serve out HTML/JS pages.
Now we are building a native mobile app of our JS web app. There doesnt seem to be good native support for Websockets on Android and ios.
I would like to keep the server code base common to both JS client and the mobile client.
What would be your suggestion for such a situation? Write a different server for mobile clients?
I found this http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps. They suggest SocketRocket for ios and https://github.com/TooTallNate/Java-WebSocket for Android.
I have never heard of these people / companies. Not sure of their antecedents and if their apps are bug free.
Any suggestions would be welcome.
I'm not sure if this is the answer you are looking for, but I tried this once, and decided to use a webpage that uses the websocket. Each app will display a webview accessing the page. All recent iOS SDK versions support this, but only the newer (4.4+) Androids will.
If you do not want to use webviews, I recommend Tavendo Autobahn for Android. I had a problem that my server's websocket would disconnect all the time. I had to implement a reconnection routine every couple of seconds on the app.
Hope it helps :)
I'm using this library on android for websockets https://github.com/codebutler/android-websockets
Works good with Spring WebSockets.
Sorry for messy answer, I'm in hurry, write in comments if u have questions

Categories

Resources