socketsupply / socket

A cross-platform runtime for Web developers to build desktop & mobile apps for any OS using any frontend library.
https://socketsupply.co/guides
Other
1.6k stars 75 forks source link

Attempting to call start() on socket:bluetooth Bluetooth constructor gives "Error: failed to start service" #975

Open doot0 opened 4 months ago

doot0 commented 4 months ago

What OS are you using (uname -a, or Windows version)?

Darwin ip-10-35-28-143.eu-west-2.compute.internal 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030 arm64

What version Socket Runtime are you using?

zsh: command not found: ssc "@socketsupply/socket": "^0.5.4" is in my package.json, though

What programming language are you using (C/C++/Go/Rust)?

gcc --version and clang --version have the same output as below. go and rustc not installed.

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

What did you expect to see and what you saw instead?

I created a new vue project using create-socket-app, have the following (reduced test case) code:

<script setup>
[...]
import { Bluetooth } from "socket:bluetooth";
[...]
const ble = new Bluetooth(<36-char-uuid>); 
const startBluetooth = async () => {
  try {
    await ble.start();
  } catch (e) {
    console.error(e);
  }
};
</script>
<template>
  <button @click="startBluetooth()">Toggle Bluetooth</button>
</template>

When I click the button with the startBluetooth method bound to it, I receive this error:

Error: Failed to start service
    at maybeMakeError (socket:ipc:345:20)
    at from (socket:ipc:892:31)
    at onresolve (socket:ipc:1183:33)
    at dispatchEvent [native code]
    at global code {
  serviceId: '<36-char-uuid>'
}

I expected this action to work, but it does not. This action fails regardless of whether or not Bluetooth is currently turned on on the device.