• Home
Name Date Size #Lines LOC

..--

heart_rate_monitor/06-Sep-2024-181132

scanner/06-Sep-2024-169124

speaker/06-Sep-2024-709554

README.mdD06-Sep-20242.2 KiB4835

bumble.jsD06-Sep-20245.6 KiB207163

ui.jsD06-Sep-20243.3 KiB10383

README.md

1Bumble For Web Browsers
2=======================
3
4Early prototype the consists of running the Bumble stack in a web browser
5environment, using [pyodide](https://pyodide.org/)
6
7Two examples are included here:
8
9  * scanner - a simple scanner
10  * speaker - a pure-web-based version of the Speaker app
11
12Both examples rely on the shared code in `bumble.js`.
13
14Running The Examples
15--------------------
16
17To run the examples, you will need an HTTP server to serve the HTML and JS files, and
18and a WebSocket server serving an HCI transport.
19
20For HCI over WebSocket, recent versions of the `netsim` virtual controller support it,
21or you may use the Bumble HCI Bridge app to bridge a WebSocket server to a virtual
22controller using some other transport (ex: `python apps/hci_bridge.py ws-server:_:9999 usb:0`).
23
24For HTTP, start an HTTP server with the `web` directory as its
25root. You can use the invoke task `inv web.serve` for convenience.
26
27In a browser, open either `scanner/scanner.html` or `speaker/speaker.html`.
28You can pass optional query parameters:
29
30  * `package` may be set to point to a local build of Bumble (`.whl` files).
31     The filename must be URL-encoded of course, and must be located under
32     the `web` directory (the HTTP server won't serve files not under its
33     root directory).
34  * `hci` may be set to specify a non-default WebSocket URL to use as the HCI
35     transport (the default is: `"ws://localhost:9922/hci`). This also needs
36     to be URL-encoded.
37
38Example:
39    With a local HTTP server running on port 8000, to run the `scanner` example
40    with a locally-built Bumble package `../bumble-0.0.163.dev5+g6f832b6.d20230812-py3-none-any.whl`
41    (assuming that `bumble-0.0.163.dev5+g6f832b6.d20230812-py3-none-any.whl` exists under the `web`
42    directory and the HCI WebSocket transport at `ws://localhost:9999/hci`, the URL with the
43    URL-encoded query parameters would be:
44    `http://localhost:8000/scanner/scanner.html?hci=ws%3A%2F%2Flocalhost%3A9999%2Fhci&package=..%2Fbumble-0.0.163.dev5%2Bg6f832b6.d20230812-py3-none-any.whl`
45
46
47NOTE: to get a local build of the Bumble package, use `inv build`, the built `.whl` file can be found in the `dist` directory.
48Make a copy of the built `.whl` file in the `web` directory.