
On Thu, 30 May 2024, at 17:05, Glyph wrote:
We should resurrect the effort to build a first-party websockets implementation: <https://github.com/twisted/twisted/issues/4173>. It's been nice to have Autobahn available, but websockets are by far the quickest and easiest way to provide a *native* demonstration of Twisted's capabilities. Luckily, we do not have to build an implementation ourselves, as a maintained sans-io kernel implementation exists in the <https://github.com/python-hyper/wsproto> project. So we just need to do a direct integration with the Resource model in twisted.web. I will probably do some work on this project myself.
Hello, I don't want to tell excited developers to _not_ do a thing, but to me this seems a little weird since Autobahn already does all of this (including "a direct integration with the Resource model in twisted.web"). And has a done a _ton_ of work to ensure strict RFC compliance and high performance. I'm 98% sure that PRs to improve any aspects of the Autobahn implementation would be accepted (by that project). Although IIRC it wasn't written with exact "Sans-IO" guidance in mind [1], the implementation is already 'fairly' separated since it supports both asyncio and Twisted (your choice) out of the box. It has been a few years while since I've directly worked on Autobahn / Crossbar but I'd be happy to pair with anyone excited about this to pass on what I do know and where things are located. I guess what I'm saying is that maybe modifying the proposed project slightly to become "integrate Hyper's state machine into Autobahn" makes a lot more sense. Assuming they handle that vast array of edge cases and weirdness that is WebSockets ;) ...or perhaps I misunderstand what "demonstrate Twisted's native capabilities" actually means in this context. [1] I don't think e.g. a "threaded" / blocking backend would work well in the current implementation, but adding an AnyIO or curio one should be (relatively) straightforward. -- meejah