muety / wakapi

📊 A minimalist, self-hosted WakaTime-compatible backend for coding statistics

Home Page:https://wakapi.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: relay broadcast to multiple instances

SIMULATAN opened this issue · comments

Currently, data can only be forwarded to a single other instance.

Since my friend and I both host WakaTime ourselves, but I also want to stream my data to WakaTime, I have to chain this final relay over his instance. Unfortunately, this introduces a hard dependency; if his instance goes down, WakaTime gets no data.

Ideally, there would be the option to add multiple connections, with heartbeats being streamed to all of them in parallel. In terms of importing data, there could be one that allows importing and the rest is just to broadcast, that's something to discuss.

I'm willing to work on this and PR my changes.

Hi @SIMULATAN, thanks for your feature request! However, I think this is too niche of a use case to be implemented in Wakapi. When deciding about new features, I'm always trying to balance between adding a good benefit to preferably many users vs. keeping the code base as simple as possible. Will close this, sorry!

However, what you could try to do is configure the "fan-out" on client side, using a forward proxy (like tinyproxy). You could set your Wakapi API key to match your WakaTime API key, then configure both your Wakapi instance and the official WakaTime as an upstream for the proxy in a way that all data is relayed to both hosts and then configure your wakatime-cli to send data to the proxy (more on that in our wiki).