Anyone tried making a WebBluetooth gateway?


#1

I was thinking about trying to port the cross platform gateway code to WebBluetooth so it could run in the browser. Has anyone tried it yet?

If you are wondering why, here is my case: We are making BLE sensors that report data to the browser. Chrome now supports WebBluetooth (on Mac, Chromebook, and Android), so we can connect directly to these sensors without needing any extra software or plugins.

I’ve already made Adafruit Bluefruit Feather based devices. But those devices can’t be easily updated over the air. It seems the Bluz might solve this OTA issue. However, I don’t want the user to need the extra gateway hardware, or run an additional application in order get updates. If instead the gateway is running in the browser then the user can just connect to the device from a web page and the code on the device could be updated.

Looking through the cross platform gateway code, it seems it would pretty simple to port it. However the browser wouldn’t be able to open a direct socket connection to the Particle Cloud. So perhaps a solution is to use websockify to proxy the particle cloud socket via a websocket.


#2

I have not tried this, but I think it would be awesome!

Yes, the Bluetooth part should be relatively straight forward, but proxying the connection to the Particle cloud might be tough. It sounds possible, but I haven’t played around with Websockets enough to know how to make it work.

Are you planning to open source the code to the project? If you are, I will throw a bounty on this if you can accomplish it. I would need to see the complete open sourced code and be able to get it running myself, if so the bounty would be:

  • 1 bluz starter kit with a bluz gateway shield and Photon
  • 3 bluz Proto shields
  • 1 $50 Adafruit Gift Card

#3

Hey Guys

I have a small sample of this working :

So far it

  • connects to a BLUZ Device
  • gets updates from RX characteristic
  • writes to TX characteristics
  • publishes RX events to particle cloud

The issue here is really the publishing to the particle cloud (using JS API)

  • the event name is configurable
  • however you’d NEVER want to run this on a public URL as the particle token is in the browser
  • OTA updates don’t work over JS API, this was designed for capturing data , viewing locally and publishing to particle

#4

So you are using the local communication of bluz to send data locally? And then using the Particle JS API to relay events to the Particle Cloud?

That is a clever workaround, but of course the DK wouldn’t be connected to the cloud itself. Still pretty cool though.

Are you intending to get the DK connected to the cloud?


#5

Hey Eric,

yes the Bluz publishes using its local communication and thats subscribed to by the browser, its then relayed to the particle cloud using an ajax request.

Basically it just allows your browser to act like the gateway