karlseguin / websocket.zig

A websocket implementation for zig
MIT License
302 stars 28 forks source link

Short-lived websocket servers (make Server.accept public) #34

Closed deanveloper closed 5 months ago

deanveloper commented 5 months ago

I'm trying to test my websocket client logic, so I'd like to create a websocket server which only lives for the duration of the test. However, there doesn't seem to be a way to create a server which only lives for a certain period of time. The Server struct is public, but the Server.accept is not, so even if I create my own server that I can deinit whenever I want, I can't connect it to a Handler.

(Should note that even though Sever.handle is public, that'd mean I have to reimplement all of the handshake logic myself since I need to provide it with an already-created connection handler)

deanveloper commented 5 months ago

(preferably this should be done in 0.11 and 0.12 branches as well)