Just for reference. Here are other Go websocket implementations:
* Gorilla WebSocket https://github.com/gorilla/websocket
* https://github.com/nhooyr/websocket
* https://github.com/gobwas/ws
* x/net/websocket https://godoc.org/golang.org/x/net/websocket

On Tuesday, September 17, 2019 at 6:29:08 PM UTC-4, Jochen Voss wrote:
>
> Dear all,
>
> Because I wanted to learn about the websocket protocol, I have implemented 
> a websocket server in Go:
>
>     code: https://github.com/seehuhn/go-websocket
>     documentation: https://godoc.org/seehuhn.de/go/websocket
>
> I would be happy to receive feedback about my code.
>
> Specific questions:
>
> - Does the API look reasonable?  Anything to improve?
>
> - I use the function readMultiplexer (at the end of reader.go) to read 
> all frame headers from the network connection, and to make sure that the 
> readers of the frame bodies don't step on each other's feet.  Similarly, 
> the function writeMultiplexer (at the end of writer.go) coordinates all 
> writers and performs all writes to the network connection.  This system is 
> held together by a tangle of go channels.  The code is much messier than I 
> would like it to be.  Is there a way to structure such code so that it is 
> easier to reason about, so that I can be more confident that it is correct?  
> The bits a struggled most with are the various ways the connection can be 
> closed (closed by server explicitly or because of a protocol error, closed 
> by client with/without close frame).
>
> - I attempted to profile the code, to find whether there are any 
> performance bottlenecks.  My code for this is in websocket_test.go 
> (function BenchmarkEcho), but the profiles then only ever show the code 
> waiting for data on go channels or for data from the network.  My feeling 
> is that I was really benchmarking the network connection and not my code.  
> Is there a way to improve BenchmarkEcho to get more meaningful results?
>
> Many thanks,
> Jochen
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a27de519-8864-46b9-ba35-733d45f1d49b%40googlegroups.com.

Reply via email to