Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bluetooth-rpc-client

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluetooth-rpc-client

The client side of a library allowing Remove Procedure Call (RPC) from a web application to a Node.js server on a Bluetooth-enabled device.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by233.33%
Maintainers
1
Weekly downloads
 
Created
Source

Bluetooth RPC Client

The client side of a library allowing Remove Procedure Call (RPC) from a web application to a Node.js server on a Bluetooth-enabled device.

Installation

To install, simply run:

npm install bluetooth-rpc-client

Usage

This library is designed to be used with bluetooth-rpc-server This library requires a browser which supports Web Bluetooth

import * as BluetoothRPCClient from 'bluetooth-rpc-client';
const serviceUuid = '...this is defined on the server...';
const characteristicUuid = '...this is defined on the server...';

BluetoothRPCClient.connect({ serviceUuid, characteristicUuid });
    .then(device => device.doSomething(1, 2, 3)) // doSomething(x, y, z) is an async function defined on the server
    .then(returnValue => {
        // ... do something with the return value here ...
    });

Upon calling BluetoothRPCClient.connect(), the user will be presented with a dialog to select the device they wish to connect to. If your server is running, you will see the device name you defined in the list. If everything goes well, the Promise will resolve with a device object, which you can use to call methods corresponding to the handlers defined on the server.

Note: all of these handlers will return a Promise, regardless of whether they were defined as async functions on the server.

Keywords

FAQs

Package last updated on 27 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc