net icon indicating copy to clipboard operation
net copied to clipboard

websocket: Clarify the status of the package as retired

Open mortie opened this issue 1 year ago • 6 comments

The websocket package is retired, as explained in https://github.com/golang/go/issues/2134#issuecomment-583785742, and its neglect has been a topic of discussion since at least 2016 (see https://github.com/golang/go/issues/18152). However, to this day, the documentation on pkg.go.dev doesn't make the status of the package clear, as I pointed out in https://github.com/golang/go/issues/60467.

This PR changes the wording to explicitly state that the package is in fact retired, as opposed to simply "lacking some features".

mortie avatar May 28 '23 11:05 mortie

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar May 28 '23 11:05 google-cla[bot]

@mortie There's a typo in your PR (maintained WebSoket package instead), and the linked WS package is also not well maintained.

binwiederhier avatar Jun 28 '23 02:06 binwiederhier

@binwiederhier I fixed the typo.

I also replaced the link to nhooyr.io/websocket with a link to gorilla/websocket, since that's apparently no longer inactive; see https://github.com/gorilla/websocket/commit/931041c5ee6de24fe9cba1aa16f1a0b910284d6d and the announcement at https://github.com/gorilla.

mortie avatar Jul 24 '23 17:07 mortie

There doesn't seem to be much interest in this. Should I just close the PR? Is the golang.org/x/net package unmaintained?

mortie avatar Aug 09 '23 14:08 mortie

这个包满足我的,因为很小,而且是官方维护。唯一不足的地方大多数人没法用它,因为不会Read。

var c *websocket.Conn
var buf bytes.Buffer
b := make([]byte, 1024)

for {
	n, err := c.Read(b)

	if n > 0 {
		buf.Write(b[:n])
	} else if err != nil {
		return
	}

	//处理帧数据,你可能有如下三种判断之一:

	if err == io.EOF { //表示帧结束? 但是你可能永远等不到io.EOF这个值
		//处理帧数据
		buf.Reset()
	}

	//或者
	if buf.Len() == c.Len() { //c.Len()? 这方法返回没有准确表达我需要的条件,不知道有什么作用:frame.Length?
		//处理帧数据
		buf.Reset()
	}

	//或者
	if buf.Len() == int(c.FrameDataLenth()) { //ok,非常棒。但是 websocket.Conn 没有这个方法:FrameDataLenth=frame.header.Length
		//处理帧数据
		buf.Reset()
	}

}

ruyi789 avatar Aug 28 '23 09:08 ruyi789

Is this repo dead?

mortie avatar Dec 20 '23 21:12 mortie