Gallapagos 2 Posted 56 minutes ago Posted 56 minutes ago (edited) I built a plugin that adds a Server-Sent Events endpoint to Emby. An app with an API key opens one HTTP connection and gets events pushed as they happen, instead of polling /Sessions. curl -N -H 'X-Emby-Token: YOUR_API_KEY' http://your-server:8096/emby/sse/events The first frame is a hello event carrying the plugin version, so you know right away the connection reached it. After that it streams: - playing, progress, paused, stopped (stopped includes playedToCompletion) - session.start and session.end - library.item.added and library.item.removed - task.started, task.progress, and task.completed for scheduled tasks - server.stats with CPU and RAM utilization every 6 seconds while a client is connected - ping keepalive every 30 seconds Payloads are small JSON objects with fields like sessionId, itemId, userId, state, and positionTicks. The full event reference and wire format are in the README. I wrote it for Tracearr, which wanted to see playback start without a polling delay, but nothing in it is Tracearr-specific. Anything that speaks SSE can consume it. Why not the existing options: webhooks need Premiere plus a URL the server can push to, which means hosting a listener. Polling /Sessions works, but you only see changes as often as you poll. This is one authenticated GET with nothing to host. Install: grab the zip from the GitHub releases page, drop Emby.Plugin.Sse.dll into your plugins directory, restart. Single DLL, nothing else. Built against 4.9.1.90, so it needs Emby 4.9 or newer. Current version is 0.4.1 and the DLL is attached to this post. Some Emby-specific behavior worth knowing if you test: - Library event ids are the numeric internal ids, the same ones the REST API returns. - Emby raises library events for container folders as well. A new movie arrives as the movie plus a Folder event for its directory, and deleting a directory fires a removed event for the folder only. Treat removals as a cue to re-query rather than expecting one event per file. - Host CPU/RAM in server.stats reads /proc, so those two fields only appear on Linux hosts. The process-level values work everywhere. Source is on GitHub under GPL-3.0: Repository Releases ship SHA-256 checksums and GitHub build attestations. What I'm looking for: people willing to run it and report what breaks, especially setups I can't easily reproduce, like Windows hosts, large libraries, or many simultaneous sessions. If it holds up I'd like to get it into the plugin catalog. Emby.Plugin.Sse.dll Edited 48 minutes ago by Gallapagos 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now