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
Related
I'm wondering it's possible to identify android device by web app running on mobile web browser? And this solution have to still working after change or upgrade web browser on this phone.
My second doubt is web app can working offline on phone showing PDF presentations saved in local storage (disk). When I have internet connection I can manually sync presentations (some are removed and some are downloaded).
If PWA app can work like I described above or in this case we need to use (hybrid) mobile app ?
PWAs allow to cache assets and make them available to the users even when they are offline. There are some functionalities that only Native Apps have (eg. access to a device contacts), but they are very close under many other aspects.
I wrote an article about Service Workers and caching strategies where I explain how to cache static assets as well as HTTP GET calls. It is part of a series about PWAs, so you might find it useful to get more insights about this technology.
Have a look at the website what web can do today to have a list of WEB APIs currently available:
I do not know the detail of your requirements, but maybe you do not even need to implement an hybrid app and simply create a PWA.
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.
I am looking to integrate Push Notification in my Jquery mobile web App using PhoneGap for Android. Is there any solution to put cloud messaging in web app like push notification.
My app is based on getting friends location and checked in new location so i was looking for messaging or push notification in web app.
i am also read about http://www.html5rocks.com/en/tutorials/eventsource/basics/
but this was not helpful for me.
If real time Push Notification not possible in HTML5 web app Please let me about asynchronous messaging like offline messaging in my app.
I recently implemented realtime messaging with the WebSocket protocol, it is easy to implement, very performant and it supports encryption.
Try Urban Airship. You get 1 million free push notifications every month.
It is also working with Phonegap.
Link: http://docs.urbanairship.com/build/phonegap.html
ScaleDrone allows pushing to (and from) PhoneGap and web. It will use Websockets if possible and other technologies when Websockets are unavailable.
There is an API for this: http://www.w3.org/TR/2014/WD-push-api-20141007/, but I wouldn't count on platform support here. However, since you are using PhoneGap, you can integrate your app with native cloud messaging. Here's a tutorial.
Push Notification can be implemented. If you are using Phonegap, PushPlugin ia a good available option. This plugin is for use with Cordova, and allows your application to receive push notifications on Amazon Fire OS, Android, iOS, Windows Phone and Windows8 devices. ALso it is free to use.
The Android implementation uses Google's GCM (Google Cloud Messaging) service.
For detailed implementation guide using Android refer Android section in this link.
Hope it will answer your question. this is late answer here, can be helpful to you as well as others looking for similar kind of solution.
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.
We have a web application. There are physical devices that we need to be able to communicate with, and we have access to all of our clients computers to install whatever software we need. Now, for the question: Is there a way to make this browser-agnostic? As in, not requiring ActiveX controls?
One of my ideas was to install a custom made webserver on each client and then have javascript on our webpage that communicates with that webserver. This could be done by the same way that http://earlz.biz.tm javascript can access subdomains assigned to 127.0.0.1 such as http://loopback.earlz.biz.tm The problem with this of course is that the client's custom made webserver would be forced to run on port 80(which will have conflicts at least sometimes), or we would have to use a nonstandard port for our web application, which is quite undesirable.
Does anyone else have ideas on how to do this?
Just to clarify. Our clients will be using regular PCs with Windows. We need to communicate with physical devices through these PCs. One such thing is a signature pad. So we want for people to be able to sign the signature pad and it show up in the web page.
I don't think browser-based is the solution for this. There are too many security issues. You're better off writing a desktop application that incorporates some web functionality.
I think web servers and possibly comet is the way to go.
Web servers can run on any port you like, as long as there aren't any firewalls blocking the ports, or they are configured to allow http traffic to pass through on different ports. Although theres nothing wrong with just using port 80 either.
On the mini web server you will then need to interact with the device. You mention you are a .net shop, so you will probably have to install linux and apache + mono on these devices - not sure if this is feasible.
Sounds like a great project.
I would try to look at Java Applets...
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html
"JDK 1.1 signed applets can access local system resources if the local system is properly set up to allow it. See the JDK 1.1 Signed Applet Example page for details."