Which websockets implementation

已查看 576 次
跳至第一个未读帖子

Amnon

未读,
2022年12月12日 13:57:192022/12/12
收件人 golang-nuts
Which websocket implementation would people recommend for a new project,
now that gorilla/websocket has been archived?

Robert Engels

未读,
2022年12月12日 15:35:592022/12/12
收件人 Amnon、golang-nuts
You can use the stdlib websocket. See https://github.com/robaho/go-trader/blob/master/internal/exchange/webserver.go for an example. 

On Dec 12, 2022, at 12:57 PM, Amnon <amn...@gmail.com> wrote:

Which websocket implementation would people recommend for a new project,

now that gorilla/websocket has been archived?

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b9bacd1c-62de-4f6f-b249-44464b61cdcen%40googlegroups.com.

Amnon

未读,
2022年12月12日 16:14:142022/12/12
收件人 golang-nuts
By stdlib, you presumably mean the x/net/websocket package, which is simple ad has a clean API.
But it is also frozen, and  has not been updated for 6 years.
Its docs begin with a deprecation notice:

// This package currently lacks some features found in alternative
// and more actively maintained WebSocket packages:
//
//    https://godoc.org/github.com/gorilla/websocket
//    https://godoc.org/nhooyr.io/websocket

https://github.com/golang/net/blob/master/websocket/websocket.go#L8-L12

Should I ignore this notice and go ahead and build my system ontop of x/net/websocket?

What would people recommend, if I need a implementation which is robust, secure and performant?

 

Robert Engels

未读,
2022年12月12日 16:22:302022/12/12
收件人 Amnon、golang-nuts
I personally like minimal packages like this. Makes them easier to tailor/debug if something goes wrong. Also simpler to take ownership/fork if needed - than a package with a ton of code. 

On Dec 12, 2022, at 3:14 PM, Amnon <amn...@gmail.com> wrote:

By stdlib, you presumably mean the x/net/websocket package, which is simple ad has a clean API.

Christian Stewart

未读,
2022年12月12日 17:52:502022/12/12
收件人 Robert Engels、Amnon、golang-nuts
I've been using this one w/o issue and at scale as well;


It also supports wasm.

Juliusz Chroboczek

未读,
2022年12月19日 21:27:502022/12/19
收件人 golan...@googlegroups.com
> By stdlib, you presumably mean the x/net/websocket package,

Careful with this library, it's not quite correct. Websocket is
a frame-oriented protocol, while x/net/websocket implements a simplistic
API that does not always preserve frame boundaries.

Correct implementations include:

https://github.com/gorilla/websocket
https://github.com/nhooyr/websocket

-- Juliusz

Jason E. Aten

未读,
2022年12月19日 22:38:332022/12/19
收件人 golang-nuts
gorrila/websocket is a very mature library. The current maintainer stepping down doesn't change that. 
I wouldn't avoid it. The very fact that its been so stable and successful for so long that there's
nothing left to do on it is actually a recommendation.

Nice tutorial:

https://blog.markvincze.com/programmatically-refreshing-a-browser-tab-from-a-golang-application/
回复全部
回复作者
转发
0 个新帖子