💾 Archived View for gemini.schuhardt.net › opal-update.gmi captured on 2022-06-03 at 22:59:20. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
Last night I pushed a major refactor of the Opal client library for .NET 6.
https://github.com/aschuhardt/Opal
The client interface is now entirely asynchronous. My original plan was to support both synchronous and asynchronous methods, but in practice maintaining two methods of doing everything turned out to require too much mental bandwidth on my part.
Given the nature of the underlying .NET plumbing, much of the synchronous implementation would have just been wrapping async features anyway. This mode of operation suits something like a network protocol client much better, and allows for use in a wide variety of applications.
The IAuthenticationDatabase interface has also been refactored to use the async/await pattern, particularly the Persistent implementation.
Rather than continuing to use C# events, the event handlers have been converted to Func<Task<...>> callback properties on IOpalClient and IAuthenticationDatabase. This makes more sense to me as, rather than supporting the 1-to-n subscriber pattern of events, I'm using these callbacks as a means for the user to provide specific pieces of information to the Gemini client. Raising an event and having a dozen subscriptions all respond to it doesn't make much sense when I need to provide a certificate password, for example.
My PR to add Opal to Krispin Schulz's Awesome Gemini list was merged, so Opal is now listed among all the fantastic Gemini-related projects over there.