Gallapagos 3 Posted August 8 Posted August 8 (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 August 8 by Gallapagos 3
Gallapagos 3 Posted August 9 Author Posted August 9 2 minutes ago, Luke said: Thanks for sharing. Certainly!
xsnipuhx 5 Posted August 27 Posted August 27 Hi @Gallapagos, I just added your plugin to my container and am running it along side tracearr. Library is decent size and can sometimes have up to 10 concurrent streams. Will report back if anything breaks. 1
Gallapagos 3 Posted August 27 Author Posted August 27 17 hours ago, xsnipuhx said: Hi @Gallapagos, I just added your plugin to my container and am running it along side tracearr. Library is decent size and can sometimes have up to 10 concurrent streams. Will report back if anything breaks. Glad to hear its working as expected!
Gallapagos 3 Posted 2 hours ago Author Posted 2 hours ago 11 hours ago, Dan_86 said: Can we get this in the catalog? I started down the road for that the day this was opened. But was told this needed to be open for awhile. Not sure what the actual expectations/timelines are but the ball is not in my court unfortunately. Hoping for the same thing!
Luke 43115 Posted 1 hour ago Posted 1 hour ago Emby SDK Documentation: Getting your Plugin in the catalog
Gallapagos 3 Posted 39 minutes ago Author Posted 39 minutes ago 43 minutes ago, Luke said: Emby SDK Documentation: Getting your Plugin in the catalog I am well aware of the process, and as i mentioned in the comment just above yours I have followed it.
ebr 16720 Posted 30 minutes ago Posted 30 minutes ago Hi. Only a couple of folks have replied here and only 5 downloads so we are watching...
Babatom 34 Posted 25 minutes ago Posted 25 minutes ago I think many more people use it than is visible here; I’ve been using it for quite a while and always install it manually. It would be nice if it could be added to the App Store.
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