No description
Find a file
2024-05-28 10:13:33 +02:00
.github/workflows first commit 2024-05-28 10:13:33 +02:00
src first commit 2024-05-28 10:13:33 +02:00
.dockerignore first commit 2024-05-28 10:13:33 +02:00
.env.example first commit 2024-05-28 10:13:33 +02:00
.eslintrc.cjs first commit 2024-05-28 10:13:33 +02:00
.gitignore first commit 2024-05-28 10:13:33 +02:00
.prettierrc first commit 2024-05-28 10:13:33 +02:00
Dockerfile first commit 2024-05-28 10:13:33 +02:00
license first commit 2024-05-28 10:13:33 +02:00
package.json first commit 2024-05-28 10:13:33 +02:00
pnpm-lock.yaml first commit 2024-05-28 10:13:33 +02:00
readme.md first commit 2024-05-28 10:13:33 +02:00
tsconfig.json first commit 2024-05-28 10:13:33 +02:00

spotify-ws

The genesis of this project stems from the inherent limitation posed by Spotify, which currently lacks direct support for accessing their API through WebSockets. In light of this restriction, developers are often compelled to resort to interval polling as the primary means of obtaining real-time data.

It's important to note that this project does not purport to resolve the challenge posed by interval polling. Instead, it takes an innovative approach by introducing a Socket.IO server. This server acts as an intermediary, relaying the current playing track to connected clients. Notably, it addresses the issue of redundancy by omitting duplicate transmissions, ensuring that clients only receive updates when the currently playing song changes.

Running Locally

With Docker

git clone https://github.com/skidoodle/spotify-ws
cd spotify-ws
docker build -t spotify-ws:main .
docker run -p 3000:3000 spotify-ws:main

Without Docker

git clone https://github.com/skidoodle/spotify-ws
cd spotify-ws
pnpm install
pnpm dev

Deploying

Docker compose

version: '3.9'
services:
    spotify-ws:
        container_name: spotify-ws
        image: 'ghcr.io/skidoodle/spotify-ws:main'
        restart: always
        environment:
            - REFRESH_TOKEN=
            - CLIENT_SECRET=
            - CLIENT_ID=
        ports:
            - '3000:3000'

Docker run

docker run \
  -d \
  --name=spotify-ws \
  --restart=always \
  -p 3000:3000 \
  -e CLIENT_ID= \
  -e CLIENT_SECRET= \
  -e REFRESH_TOKEN= \
  ghcr.io/skidoodle/spotify-ws:main

License

AGPL-3.0