-
-
Notifications
You must be signed in to change notification settings - Fork 811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic plugins through simple scripts #1736
Comments
This seems like the closest to the idea of plugins that I've had in mind. I wonder what the limitations will be as I can't imagine them right now. |
That's a really interesting concept and maintains a high level of linguistic flexibility. JSON would probably give the best possible option since I haven't found a language that doesn't have JSON either built-in or a well maintained, stable library. XML is hit or miss most of the time. As an idea though, it could even be set as a one-shot type system - only running the scripts/execs when needed, thus saving resources. It would have to launch it STDIN the data and wait for exit. You could probably get an initial system up with a single direction of communication, from Owncast to plugin, up and running with little effort and worry about the other direction later. |
This is a really cool idea! So a few thoughts: probably the best way to save resources/maintain performance is for the plugins to launch as a long-lived process, as opposed to launching a process for each and every event. The plugin API could be as simple as - a process reads a JSON stanzas on stdin, writes a JSON stanza on stdout, Owncast reacts accordingly. If the process exits successfully, Owncast relaunches it on the next event, if it exits with a non-zero exit code, it doesn't get started again. This would allow for both the long-lived process model, or for users to write simple scripts that just do a single thing and exit. As far as SDKs go, I probably wouldn't put a lot of effort into that part. There's so many languages, and if the API is simple enough, most people would just need JSON serialization/deserialization libraries. Would there need to be a method of registering for specific events? Or would just having all events go to these plugins work OK? One idea is you could have folders representing event types, every executable in those folders only gets those events. Or maybe you have the plugin write out some JSON at start-up indicating what events its interested in? |
I'm not sure about registration for events. Maybe. The thing about stdin is if you pass something there, and wait for a response (for example, your filtering idea), but that plugin doesn't support filtering, there's no way for Owncast to know that, and the event would go into the void. So maybe registering for events would be required. Or maybe a plugin can have a manifest that describes what events it knows how to handle, or like you said, the plugin itself just does it, and Owncast reads it upon plugin loading. The downside of a plugin per event is from a developer standpoint, I wouldn't want to write and build 20 Go binaries, for example. And from the Owncast side, it has to manage more stdin/stdout connections to plugins. Not that it's a huge deal, since that would have to be managed anyway to support multiple different plugins being loaded. |
I've yet to give up on the plugin idea, even though it's been in a state of limbo for a long time because there hasn't been a clear solution for it. But I think I've come up with something simple, extensible, and flexible enough for a lot of people.
I'd like to experiment with
stdin/out
-based "plugin" system that almost works like the webhooks, but requires no servers, and no external infrastructure.plugins
directory.Pros:
Cons:
This isn't something I'm going to rush to get in, but I think it could ease the extensibility of Owncast, and could grow over time with more events. I'd love to hear any feedback people have!
The text was updated successfully, but these errors were encountered: