Can I use phonertc to send arbitrary data? - phonertc

I'm trying to use Phonegap/Cordova to send data between mobile and desktop application and between mobile to mobile via local network (just local p2p).
I've seen that in phonertc I can pick video/audio streams between devices, but what if I want to send regular objects through - or maybe using http://peerjs.com/

This is an old question, and perhaps you've moved on with your requirements; but I think what you were looking for was socket.io P2P.

Related

How do you properly use ChannelAPI to send a file from wear to mobile and vice versa?

I am trying to record audio on the wear and send it to the mobile and vice versa using the Channel API. However I can't find a working example of how to write this. Can anyone help? Thanks.
You can use WearCompanionLibrary that provides an API for that. The sample WclDemoSample uses that library and one of the features shown there is exactly that; it sends the audio stream (captured from microphone) from a wear device to the connected phone in real-time, using ChannelApi. If you don't want to use the library, you can take a look inside and see how it is done.

Web application and remote raspberry 2 way communication

I'm designing a web application that should communicate with a remote raspberry (or similar devices for what it matters)
I need to achieve these goals:
user be able to send commands and receive answers
device be able to send data on his own initiative
when the user is offline, the application server should be able to get updates from the device
http://i.stack.imgur.com/hHbPb.png
Actually I'm at this stage of designing. I cannot figure out what to put in A and B boxes.
I was thinking about node.js on the B side, and it would work very smooth if I only needed to send direct commands from the frontend, but I also need to update the DB and get the application and the raspberry communicate when the user is offline.
Any ideas?
Thanks a lot.
To answer your question, I need to make few assumptions:
you have chosen SpringMVC because you're familiar with Java,
you read from Raspberry comes in via GPIO pins
you're ok with polling Raspberry for data
you want to narrow down the amount of technologies used
Then this one may help:
http://elinux.org/RPi_Low-level_peripherals#Java_Webapp_GPIO_web_control_via_http

broadcasting data to mobile devices

I working on a project were mobile users can receive alerts based on diferent factors, the server side will be implemented using the MVC framework.
My question is regarding the client side; what would be the most efficient way to send the alerts to the clients? is there any way to broadcast the alerts to each device or do I have to set up some system where each device pulls the data from the server on an interval of mins/seconds? I am afraid pulling the data every X secs/mins would create an unnesesary overhead on the mobile devices.
One way would be using SMS but SMS gateway services are expensive and not on my budget right now.
I haven't personally tried it, but this service might work for you:
http://www.airgramapp.com/api
It is free for limited use. Downside is it appears to be a separate install on the mobile device. This might means less control of the content of the message or its look. Upside is it looks quick and easy if you just need a proof of concept at this point.

What is the best solution for real-time bi-directional communication between a web application running on a mobile phone and a server?

I'm looking at having thousands of simultaneous connections from mobile phones to the server whereby anytime a user interacts with his cell phone, the data is sent and logged by the server. Also, anytime the server has new information for that user, the server can push that information without a browser refresh. I am wondering what is more stable and how you would build this?
A good real-time framework or infrastructure will have numerous APIs that should let you connect any device, no matter the technology, to the real-time server e.g. an iOS client library for iPhone and iPad, a JavaScript client library for numerous platforms including normal and mobile web, an Android compatible Java library and so on.
An interesting idea might be to choose which ever framework or real-time service suits your needs best and then using something like PhoneGap. But, as #rt2088 says, it depends if you need the notification app to be running as a service on the phone or as a standalone application.
The choice will also depend on whether you want to install, host, maintain and manage the scaling of your own real-time services or not. If not, there are a number of services out there who you could use so you can concentrate on building your application. If you do want to manage your own infrastructure then the Comet Maturity guide could be a good start. It's a little out of date but is still probably the best reference available.
the ability to push new content the
user based on his GPS location which
is "pinged" to our server. Based on
that, we deliver local content. What
frameworks are you talking about?
There are a number of real-time frameworks available at the moment. Some are hosted services and others require installation on your own hardware. The majority of them will come with a bunch of libraries in different technologies that make it easier to get up and running with them e.g. a JavaScript library that wraps the WebSocket object and also manages fallback for web browsers that don't support WebSockets.
I've just created a Real-Time Technologies Guide in which I've listed all the real-time technologies that I could think of and provided a bunch of tags associated with each.
wouldn't a javascript client library
cover all platforms if it is a web
appilcation?
If the application is a web application then yes, a JavaScript library would be all you need for the client application. The server side libraries that you require would depend on the real-time technology you choose.
Best solution to achieve this is to use the WebSocket communication. It is bidirectional asynchronous communication. Currently every browser supports this new standard and plenty of code snippets available. You just have to google it. There are many server and client side frameworks. choose the one best suits to your requirement.
The details of the WebSocket specification is available at -
Websocket specification
Do you need notification when user uses mobile browser of handset or the mobile handset itself (performing non-browser tasks)? Based on that, the framework to record user activity can be selected.

Windows Phone 7 - how to send files from/to the app?

I'm trying to write the most basic application for windows phone 7 and want to be able to send files (specifically XML in case that changes anything) to my app. Currently I have a WCF service setup so I can send push notifications through it. The problem is that there is a limit on the amount of raw data I can send via a push notification.
My solution to this is to send the initial push notification (either tile or raw) to alert my application that I want to send a file to it and then make the app somehow communicate with a server (everything is on my personal computer btw - I'm just trying to figure out how things work) - from which the app will recieve/download the files.
What is the easiest way to accomplish this? Note that I'm not concerned with security or anything like that.
Clarification - the question is essentialy: how do I transfer files from/to a server to/from the phone? Assume everything else was handled - the app is up and running and the user has given or will give permissions to every possible thing he may give his permission to.
Unfortunately, the total size of a push notification (including HTTP headers) is 1kb. This means that it can't be used to send large amounts of data.
Instead of sending the whole file, send a notification (raw or toast—as appropriate) which should be treated by the application as a trigger to go and retrieve the new file/data/whatever from the server. It may also be worth checking for new messages when your app starts. However, if when you start the app it will notify the server that it is ready to receive raw notifications and such messages will be sent indicating new content is available, it may be unnecessary to add this extra check.
To transfer files to/from the phone you will need to use either HttpWebRequest or WebClient as this is the only way to use HTTP on the device and HTTP is the only protocol currently available to transfer data.
While WebClient may appear to be easier to use than HttpWebRequest it is less flexible and will automatically perform it's callback on the UI thread and if you're downloading files in the background you almost certainly don't want this.
There is no way to transfer files to/from a conencted PC and have them exclusively available to your app.
First of all: you won't be able to do this approach automatically - the user will have to open your app to do that because WP7 SDK doesn't allow your app to run on background/start automatically once a push notification is received.
The only way to communicate with your server, at this point in time, is web services. If I were you, I would check for new information available once the app is started, if there is new info, I would call one or more web services which would return me all the information that I need.
If you want, you can use a timer to check for information periodically.
As I said, it will only work while your app is running (check the app lifecycle if you don't know it yet), WP7 doesn't allow apps to run in background, that is a serious limitation IMHO.
Good Luck,
Oscar
Maybe a little bit off topic but when I was thinking about file sharing in my WP7 app, I found two approaches:
Integrate an app with Dropbox
Use advanced explorer for WP7
You can use the WebClient class and the DownloadStringAsync method in order to download data from a web service .
A good example of this is Scott Guthrie's Twitter app from MIX10 .
George

Resources