Gallapagos 6 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 1 3
Gallapagos 6 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 6 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 6 Posted yesterday at 07:15 PM Author Posted yesterday at 07:15 PM 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 43124 Posted yesterday at 08:28 PM Posted yesterday at 08:28 PM Emby SDK Documentation: Getting your Plugin in the catalog 1
Gallapagos 6 Posted yesterday at 09:13 PM Author Posted yesterday at 09:13 PM 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 16725 Posted yesterday at 09:22 PM Posted yesterday at 09:22 PM Hi. Only a couple of folks have replied here and only 5 downloads so we are watching... 1
Babatom 37 Posted yesterday at 09:27 PM Posted yesterday at 09:27 PM 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. 3
Gallapagos 6 Posted 23 hours ago Author Posted 23 hours ago (edited) 1 hour ago, Babatom said: 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. That is absolutely the case, and I let them know that in the initial contact. Never got a response after that though. Not too pressed about, but like i said the ball is not in my court (if it was it'd be done lol) I just want Tracearr users to have less friction to install, and the opportunity for other developers to take advantage of this plugin with ease. Edited 22 hours ago by Gallapagos
Gallapagos 6 Posted 22 hours ago Author Posted 22 hours ago (edited) 1 hour ago, ebr said: Hi. Only a couple of folks have replied here and only 5 downloads so we are watching... I'm not sure these forums are as popular as assumed here, as the real numbers are significantly higher. Breakdown of downloads per version from GitHub (our linked trusted download source) as of the posting of this message: v0.5.0 - 1,565 v0.4.1 - 2,132 v0.4.0 - 552 v0.3.0 - 929 v0.2.0 - 993 v0.1.0 - 493 Tracearr itself has over 5.5 million pulls this year. Only reason I am here on the forums is to try to move the ball forward on the catalog listing. Edited 22 hours ago by Gallapagos 1 1
xsnipuhx 5 Posted 20 hours ago Posted 20 hours ago My two cents on this...I've been running it since the end of August. The playback reporting is vastly superior when compared to the standard Emby playback reporting that is in the catalog. The plugin isn't required, but its nice to have the extra bit of data that comes with it. I don't think I could go back to the standard reporting. My ONLY issue is with the app itself, and not the plugin. It uses a LOT of ram. Regardless though, the app has earned its place in my stack.
Gallapagos 6 Posted 17 hours ago Author Posted 17 hours ago 2 hours ago, xsnipuhx said: My two cents on this...I've been running it since the end of August. The playback reporting is vastly superior when compared to the standard Emby playback reporting that is in the catalog. The plugin isn't required, but its nice to have the extra bit of data that comes with it. I don't think I could go back to the standard reporting. My ONLY issue is with the app itself, and not the plugin. It uses a LOT of ram. Regardless though, the app has earned its place in my stack. We certainly strive to outshine the competition and give the most insightful statistics that server owners value! As far as memory goes, if setup correctly it averages under 1gb. Correctly is really just following the docs/callouts in the compose examples. But also using a shared PG instance across many applications is a good way to spread the load out.
Gallapagos 6 Posted 1 hour ago Author Posted 1 hour ago TLDR for anyone landing here who doesn't want to read the whole thread: I asked about the catalog the day this thread opened (Aug 8th and was told it needed time on the forum to gauge interest and work out bugs. Fair enough. That was six weeks ago. Where it stands today: - 6,664 downloads across six releases on GitHub. The first post sends people there to install, so the attachment count on this thread was never going to show much - no bug reports in this thread, and people here who have been running it for weeks @ebr@Luke I don't know what number you're looking for or where you want it counted, so I can't tell if we're close. What does the plugin need to hit, and over how long? Give me a bar and I'll go meet it. Everyone else: if you run this, drop a quick reply here with your setup. Thousands of installs on GitHub apparently don't count, replies on this thread apparently do, so that's where I need you. Thanks to everyone who uses Tracearr and helps make it great, - Gallapagos
ebr 16725 Posted 1 hour ago Posted 1 hour ago We're currently working on a few updates to the catalog system. Let us get those finished up and then we can get you setup. Ping me in the PM next week. Thanks. 1
Babatom 37 Posted 55 minutes ago Posted 55 minutes ago Perhaps it would also be possible to allow custom repositories, like with Jellyfin...?
ebr 16725 Posted 47 minutes ago Posted 47 minutes ago 7 minutes ago, Babatom said: Perhaps it would also be possible to allow custom repositories, like with Jellyfin...? That is not in our current plans. Too much liability risk for us and too many issues with the stores.
yocker 1928 Posted 13 minutes ago Posted 13 minutes ago 49 minutes ago, Gallapagos said: TLDR for anyone landing here who doesn't want to read the whole thread: I asked about the catalog the day this thread opened (Aug 8th and was told it needed time on the forum to gauge interest and work out bugs. Fair enough. That was six weeks ago. Where it stands today: - 6,664 downloads across six releases on GitHub. The first post sends people there to install, so the attachment count on this thread was never going to show much - no bug reports in this thread, and people here who have been running it for weeks @ebr@Luke I don't know what number you're looking for or where you want it counted, so I can't tell if we're close. What does the plugin need to hit, and over how long? Give me a bar and I'll go meet it. Everyone else: if you run this, drop a quick reply here with your setup. Thousands of installs on GitHub apparently don't count, replies on this thread apparently do, so that's where I need you. Thanks to everyone who uses Tracearr and helps make it great, - Gallapagos Your plugin (Nice work!) while gathering a following much faster than my plugins hasn't had much time "on the bench" yet next to what min had before i could get them in the catalog, granted i can be a bit of an idiot at times.. This is not a slight at Emby, just a "Have patience young padawan"!
yocker 1928 Posted 8 minutes ago Posted 8 minutes ago (edited) 47 minutes ago, Babatom said: Perhaps it would also be possible to allow custom repositories, like with Jellyfin...? Funnily enough a plugin could possible be made for that. There's a plugin from @bakes82that almost does something like it. Add a list of known github repos and it could be used for that purpose. With permission from the owners ofc. Edited 7 minutes ago by yocker
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