I want to control a robot from the web, the robot is connected to Android device. The operation will be as the following :
a web application written using JavaScript and HTML runs on desktop computer which takes the keyboard input from the user and send them to the android device connected to the robot.
the android device receive the commands and then send them to Arduino board which used to control the robot.
But how should I deliver the data to the Android device which doesn't has a static IP address?
I have two approaches to solve that :
the JavaScript application sends the keyboard input to a web server runs PHP and MySQL , then the php application store the data on the MySQL database. An application runs on Android connected to that web server and extract the data from the MySQL database.
the JavaScript sends the data to the web server. The android application connected to the web server receives the data directly so the web server is just used as a relay.
The first approach is easy to do but its slow , so my question is...
How to implement the second approach and which web technologies should I use to implement it? And how to make the web server works as relay between two sides?
PS : I am planning to use 000webhost.com as web server. so I will not use my own server
You can either have your Android application poll the webserver for outstanding commands. This is a little inefficient in terms of data usage, but if you're on an unlimited 3G plan / wi-fi, you could live with it. It will be very easy to implement.
Alternatively, set up a TCP server on your server, and have your Android application open a socket connection with the server. This way, your web application can send commands to the server which will immediately stream them to the Android device. It will be slightly harder to implement, but will be more efficient and robust if done right.
PS - Most shared servers don't allow you to open a TCP server on your host so you might be forced to go with the first option.
PPS - I wasn't aware of Google Cloud Messaging. It seems to be a good solution for you what you're attempting to achieve. You should have a look into it.
Related
I have 3 server that same server application is running on each of them. each installation of server app has its own configurations, data and settings.
other client users or client applications can connect to this servers and communicate with them.
this servers are in different places.
this application are created by PHP and servers are ubuntu servers, each server has its own static IP.
but now i need to share some data between this server applications. for example server A needs to access to information of server B's customers. or main admin of system want to see some information of server C. other scenario may be back up/sync. each server with 4th server with special application.
what is the best and more secure way to share some data between server applications? for example application A on server A needs some data get from application B on server B, or send some data to it.
There are several ways to do this, and it depends on if your goal is to send data synchronously or asynchronously.
If you want to send data synchronously (that is, send data, and wait for a response before proceeding to whatever the next step), use HTTPS.
If you want to send data asynchronously (that is, send data, then go off and do something else while the response can come back at any time), use XMPPS.
Both run over SSL, so that will handle the security side of things. Both HTTP and XMPP services are plentiful, so building the scripts to use these services for communication would be relatively straight-forward.
I am thinking about a scenario where I want to send a data packet from my php service (based on certain behaviour) to a client (can be Android or Windows) connected to it.
A device which is connected to the internet is going to have an ip address.
So is it possible to send a packet (using socket or else) to this ip directly (without polling from client end) and can this data be read from the client.
Scenario is like this :
Client A --------------Registers Own IP Address-----------------> Server
Client B --------------Registers Own IP Address-----------------> Server
Events :
Some changes occur in the database (say)
Server detects the affected client (via some algo),say Client A
Sends a packet to Client A
Client A <--------------Send Data Packet----------------- Server
Is this at-all possible ?
If yes, how effective can this be ?
Please note that, Push notifications is not applicable in my situation.
I am looking for a live (realtime) data transmission system between client and server (both ways).
Any suggestion, help will be useful. Thanx
Absolutely possible to have persistent sockets open.
but I would say this would fail in a hosted environment. GoDaddy etc shuts that down. Been there done that.
I would highly recommend choosing a programming language like java (Whatever you are comfortable with). It is only going to be 200 lines of code.
I want a develop a web application with php, and I want a run my apps with a android device. But my device will not be connected to internet, so I must create a local server on the device to run my php code. Is it possible? And if it's possible how?
Based on this page, developing Web Server for mobile devices is still on the research phase. Most probably you would need to use some kind of simulator for Android and develop your App on powerful desktop PC.
EDIT: Looks like such a server exists for Android.
Please use KSWEB.apk. This app supports PHP, SQL, html, csc, but it requires 3 android devices. The first serves as router, the 2nd device is a local server and the 3rd devices is a monitor.
I'm not sure about your need to have a web server running on your phone, but if you have a wireless router and your phone can connect to it, can you not install an Apache server with PHP support on your development PC and access it via your phone's wireless connection?
I will be developing an application for a club where they will have visitors use biometric systems(finger print) or magnetic cards to mark their attendance.
This application is planned as a web app, made using PHP/MySQL/Javascript. It does a lot of other things as well.
What I wanted to find out is how is the interface between Biometric/Megnetic Card systems to a web app done?
I've never worked on this and am hoping if someone who has experience with this can throw some light on this as to how this could be accomplished. Any pointers will be appreciated.
Also, we will be hosting this application remotely. So we won't have physical access to the web-server.
(I'm afraid there's got to be some form of application installed on a pc that would interface with the hardware and probably makes calls to the web app. But, if there was a way to connect it to the web app directly, then the app would be easy to deploy to any location with minimal installation.)
Thanks! :)
How is the hardware connected? Directly to the app server, or to a standalone box of some sort? If it's a standalone box, then yes you'll have to have some kind of program on the box collect the data and send it to the web app. If it's connected directly to the app server, then you need to write something that either polls the hardware or receives messages/events from the driver and DTRT wrt the web app.
There three type of communication channels are supported by the biometric machines. They are serial, TCP/IP and HTTP. In your case, you either need to implement TCP/IP or HTTP.
If your application is running the intranet, then you can implement the TCP/IP server application and host at a intranet system which is expected to write in a common database between the biometric application and your web-app.
If your application is hosted at the server, then you can implement the http server and associated the URL with the machine. For this you need buy the http api supported machines. Here is the google search link for finding such machines.
I have built a simple TAPI app that will run on a machine on the LAN that connects to the office PBX, it allows me to receive dial, answer, hangup etc commands (which I was planning on receiving via a udp packet). I did this with the intention to integrate the office CRM system to the phone system.
Having done this and testing using a simple python app to send the udp packets I find myself wondering how to send the udp packets to this app given that the CRM system is a web app written in php/javascript.
We use Firefox in the office and so I was going to start with a Firefox extension, but I thought I would ask and see if anyone has any experience on sending udp packets over a lan from a browser using java or flash or from a browser extension/plugin.
Or is there a better cross browser way to send commands to an app on a network pc when the web app is hosted online?
Maybe in the CRM you could use javascript and JSONP to make a request to a local HTTP server, and that server could then send the UDP packets instead.