Code Monkey home page Code Monkey logo

roon-api-grpc-bridge's Introduction

Roon API gRPC Bridge

This project is a Roon Extension. Running this extension starts a gRPC server that acts as a bridge to RoonBrowseApi, RoonImageApi, and RoonTransportApi for a single paired core. gRPC services are defined using protocol buffers, which allows generating idiomatic client libraries for the service in 9+ languages. This project includes a protobuf service definition matching the Roon client APIs, allowing API consumers to use an idiomatic client library in their preferred language to interact with the Roon API, rather than being restricted to using Node.js.

Setup

This project and its examples are built with Bazel. To build and run from source, you will need to first install Bazel for your platform using the instructions provided here. Bazel will manage its own versions of all the project's dependencies (including the Node.js runtime for the server and Go SDK + protobuf compiler for the examples), so in theory you shouldn't need to install anything else.

As an alternative, if you don't need to run the examples and would prefer not to install Bazel, you can run the extension using Node.js directly.

Bridge Server

The service definition can be found in protos/roon.proto. The protos/BUILD file contains an example of using Bazel to generate a service client library for Go. If you want to use the service definition from another language/platform, you can either use Bazel to define additional language-specific build rules depending on the //protos:roon_proto target, or invoke the gRPC proto compiler for your preferred language manually on the roon.proto file. See the gRPC Docs for instructions on getting started for various platforms.

Running with Bazel

To run the bridge server using Bazel, run the following from the repository root:

bazel run //:bridge-server

The gRPC API started by the extension will bind to 0.0.0.0:50051 by default. The host and port may alternatively be specified with the --host argument:

bazel run //:bridge-server -- --host 127.0.0.1:5678

Bazel will install and manage its own instance of Node.js along with the bridge-server's npm dependencies, so this is the easiest way to get up and running without any additional setup.

Running with Node

To run using an existing Node.js installation, first install the bridge server dependencies using npm install. Then from the repository root, run:

node .
# Or, when using the --host arg:
node . --host 127.0.0.1:5678

Extension authorization

The first time you run the bridge server, you will need to authorize it in Roon. This can be done from Settings>Extensions.

Running the example

The examples directory contains an example Go client calling the gRPC API. The example calls ListAllZones and logs the output, then does a series of Browse and Load calls to demonstrate playing an album from the Roon library in the given zone (it chooses the first in the album list for demo purposes). To run the example using Bazel, run the following from the repository root:

bazel run //examples:bridge_client

roon-api-grpc-bridge's People

Contributors

sbosley avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.