obs-websocket-dotnet
obs-websocket-dotnet copied to clipboard
Massive Refactor
This is a fork I've been working on for my own project. There's a lot of changes, so I thought I'd make this draft PR so you can see if it's something you'd want to merge or make a branch off of.
Highlights:
- Switched from WebSocketSharp to WebSocket4Net.
- .Net Standard 2.0 target.
- All requests converted to async Tasks.
- All events use
EventHandler
orEventHandler<T>
, withT
being a class derived fromEventArgs
. - C# 8.0 with nullables.
We recently pushed a change to move to .Net Core 3.1 This is way to big a change to be able to review but happy to work with you on multiple smaller PRs
Good changes, but as owner wrote, will be good to have smaller PR with specific changes :) Lets try to write on .Net core @BarRaider do you have already start to work on? Can you give the branch?
Shame this never got any further as I have just come in to see if anyone had any forks making events regular EventHandler<T>
and making the connection async/task based, this seem perfect.
@Zingabopp did you ever release this anywhere on nuget under a different name or anything?
@grofit I haven't done any actual releases with it. I did the conversion to use in another project of mine, so I just added this as a submodule for that. I may eventually do an update for 5.0, but I'm not currently working on it.
For the moment I've just dumped the core files into my repo as it's own project and it's working great so far (.net 6)
As mentioned before I would highly encourage the team working on the v5 branches to adopt some of the patterns here.
The biggest thing for me is the event handler changes, as I'm wrapping all events as IObservables it's trivial to do with EventHandler<T> but much more of a pain to do with custom delegates.
Also the current paradigm for connecting and interactions are not clear on what's happening or how to indicate failure states etc, so it's very nice being able to have a bool returned for confirmation of success as well as it all being Task based so you can await etc.
Sorry to communicate with @Zingabopp through here, his fork doesnt have issues enabled, but I am having to make some alterations to your branch around certain JSON fields which may have been added since, are you wanting me to fork yours and PR back in any fixes I add or are you not bothered?
(I appreciate with v5 coming soon most of it will be moot anyway)
@grofit feel free to make PRs. I also enabled Issues if there's anything else you want to bring up.
Closing this as a PR since there isn't really a way to merge something this big (and was relevant for 4.9.x anyways). We can discuss a incremental approach if the community feels they want these features in the new v5