Web Bluetooth send text from phone to browser - ios

I've been doing a lot of reading and research on Web Bluetooth.
I just want to send some text from a BLE Server (in this case a web app running on iOS WebBLE app)...and have the text appear on another web app running on Chrome on my Mac.
I just want a textarea and a send button for the Server and a dynamically updatable span on the client.
Seems like all tutorials assume Server is some kind of peripheral (monitor, light bulb, etc)..and that you just have to write Client code to interact with it.
Is it possible to do this? Seems like it should be simple. Thanks
I guess I'm asking how to turn desktop Chrome into peripheral device using Web BT
How can I get my Mac browser to advertise using Web BT?

The Web Bluetooth API does not include APIs for acting in the peripheral role. A page using the API can only take on the role of the central.

Related

Printing from a mobile with Firefox OS

Is it possible - and if so, how? - to print from a Firefox OS phone?
Looking for a real mobile solution - e.g., printing out a receipt using mobile phone and a small receipt printer (connected probably through usb or wifi tethering) at a marketplace, on a train, etc. (The mobile will communicate through internet with a server, so it will have an internet connection.)
If you can get the printer on the same network as the Firefox OS device then you could try running this pure JavaScript implementation of the Internet Printing Protocol to send a file to the printer from your app. It would definitely need some changes to use standard web APIs rather than Node JS APIs. It may be possible to implement it with XMLHttpRequest or perhaps something lower level like TCPSocket.

Can you communicate with nearby devices using a website?

Can a website help a user communicate with nearby devices via bluetooth/WLAN without downloading software?
User requests that something be done on their device (which could be, for example a wirelessly connected printer or a bluetooth keyboard).
The site, which contains a repository of relevant actions, sends specific instructions for that device to the user's own machine.
Those instructions are then relayed to the correct device (with the user's permission) via the user's device's WLAN or existing bluetooth connection.
Part 3 is what I'm not sure of - is there a mechanism by which a website can contribute to a wireless/bluetooth connection held locally?
It is not possible. User browser can't interact with hardware for wireless networking.
You should force user to install some custom software to do this.
You would have to submit the "commands" first, then have the device make requests to the website server, i.e., check for any pending "commands" for the device, and then process them locally. A website is not "thing" that can directly interface with a hardware device.

iOS using sockets to talk to other apps

Is it possible to have 2 apps on 1 iPhone/iPad talk to another via sockets? For example The main app is phonegap app that just displays data and when the user clicks the print button, the 1st app sends data to the 2nd (2nd app stays in the background, I guess it is a service), it (the 2nd app) then sends that data to a printer that it knows how to talk to whether that is via a webservice call or something else.
From my scan of the docs and other questions it seems the custom URL is one way to make the apps talk, but I want the receiver app to stay in the background. So do I have to use a server/client approach to this? Is that possible.
Sure you can. Just make sure your 2nd app - the background app is conformed to Apple's requirement to run in background modes. You can also use Bonjour to aid in discovery or just pre-selected a port and make other apps aware of it value.
No, there is no socket-based interprocess communication between apps on an iPhone, nor is there any concept of apps as background services. Using custom URLs to launch another app is the only direct method of communication between apps.
On the other hand, if the 2nd app is talking to a printer (or anything else) via a web service, I'm not sure why you wouldn't just have the 1st app use that web service to print directly. Is there a particular reason you need a background app to perform this function?

Provide geolocation data to iOS from Windows

I'd like to use a computer using Windows 7 to provide data to an iOS device. I guess there is no way to do that by Wifi so I'd like to simulate a bluetooth GPS device on my Windows 7 computer so that the iOS device would connect to it.
My question is, what kind of data should I sent ? Can I directly send NMEA frames or should I implement another Apple protocol ? Where can I find specification on those protocol in iOS ?
The idea is to make geolocation data to be available to the whole system. Maybe by "simulating" a bluetooth external GPS receiver using a software that I would develop on Windows. So what kind of data should my Windows software send by bluetooth to iOS ? And how can it be detected by iOS as an external GPS receiver ?
Thanks.
I recommend to use bonjour.
It's a auto-connecting protocol which finds other "player" in the same subnet (lets say same "WiFi".
Theres a windows sdk written in C:
https://developer.apple.com/opensource/
How you do submit the data is up to you. You might create a JSON payload out of your GPS Data. You can also create a binary format and compress it with libz (zip) before sending it to your iOS Device through bonjour.
You can also set up a web server and a web service on your PC and simple connect to it through local network (WiFi) from your device. I think this requires the least work from both server and client side. Which format do you use (JSON, fractions of NMEA, something else) is really up to you since you will have to code both server and client side. For JSON and XML however there are a lot of free frameworks and even some SDK support on both client (iOS) and server (php, asp, servlets, etc) side.

iOS - Possible for Safari HTML5 Web Sockets to Communicate with App on Same Device?

Is it possible to use html5 web sockets in mobile safari to communicate with another app on the same device? Basically, I'd like to build a socket server in a custom app and have my javascript on a page in mobile safari send messages to it via html web sockets. I have very little experience with sockets and just thought I'd throw this idea out there.
No -- there is no background mode which will allow a native iOS application to "legally" keep a socket server running. The only three modes which can fully run in the background are "audio", "VoIP", and "location", and your application probably wouldn't fall into any of these categories.

Resources