Skip to content

Project-Sonata/Sonata-Connect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sonata-Connect

Synchronize all your devices, control playback and switch between devices in one click!

Sonata-Connect is a part of Sonata-Project that provides the ability to control your devices using HTTP endpoints, allows to authenticate your device without using your password in secure way and switch between devices without any problem!

Table of contents

API endpoints

Device authentication

Here is described how Sonata-Connect works to authenticate device without using password

Terminology:

  • Device X - not connected device.
  • Device A - already connected device to Sonata-Connect that capable for music streaming and playback manipulation.
  • SCAT - Sonata-Connect authentication token. Used to authenticate the device without password.

Requirements:

  • Device supports MDNS
  • Device supports JSON

When device X is launched, then it registers itself in MDNS network. Device A listens to event when a Device X has been registered and then sends an HTTP request to connect device X

image not found

Types of devices that can be registered with Sonata-Connect flow:

  • TV
  • Speakers

After that a device is appeared on user screen and user can start playback on Device X.

  • User clicks on device X on Sonata-Connect form.
  • Device A sends request to Sonata-Connect,
  • Sonata-Connect generate SCAT that contains info about target device.
  • Device A receives in response SCAT token, then SCAT is being sent to Device X using MDNS in local WI-FI area.

Then target device X do:

  • retrieve SCAT from request
  • send request to Sonata-Connect to exchange SCAT for access token
  • Sonata-Connect checks token validity and if it's valid sends access token
  • target device got access token and now can stream music and control playback.

How it works?

Microservice store the current player state for each user in cache(In memory or Redis for better performance).

All operations with playback is performed using HTTP endpoints, any write operation to WebSocket connection is ignored.

Each operation that changes a player state sends a real-time update to WebSocket connection that every device can update its own state.

Messaging format is JSON.

no image

About

Control playback from all your devices in one click!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published