Gorilla WebSocket 与 golang 的对比org/x/net/websocket
Gorilla WebSocket compared with golang.org/x/net/websocket
根据Gorilla Websockets Project it is not possible to send pings and pongs using golang.org/x/net/websocket. At the same time, the following is on the project page of golang.org/x/net/websocket:
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
我有点困惑。 golang.org/x/net/websocket 实现了 RFC 6455 但无法发送控制帧(取消、ping、pong),尽管这在 RFC 6455 - Section Control Frames
中指定
那么如果我使用 golang.org/x/net/websocket 包会发生什么。超时后连接会中止吗?也就是说,这里是如何保证连接不断开的。
According Gorilla Websockets Project it is not possible to send pings and pongs using golang.org/x/net/websocket
Gorilla README says有些不同。它说 golang.org/x/net 包不能 发送 ping 或 接收 pong。并没有说包裹不会发pong。
golang.org/x/net 包通过向对等点发送 pong 来自动响应从对等点收到的 ping,Gorilla 包也是如此。这两个包都可以与使用 ping 和 pong 来保持连接的对等点一起正常工作。
使用 golang.org/x/net/websocket 包的应用程序不能使用 ping 和 pong 来保持连接。无法发送 ping。无法检测是否已收到乒乓球。
根据Gorilla Websockets Project it is not possible to send pings and pongs using golang.org/x/net/websocket. At the same time, the following is on the project page of golang.org/x/net/websocket:
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
我有点困惑。 golang.org/x/net/websocket 实现了 RFC 6455 但无法发送控制帧(取消、ping、pong),尽管这在 RFC 6455 - Section Control Frames
中指定那么如果我使用 golang.org/x/net/websocket 包会发生什么。超时后连接会中止吗?也就是说,这里是如何保证连接不断开的。
According Gorilla Websockets Project it is not possible to send pings and pongs using golang.org/x/net/websocket
Gorilla README says有些不同。它说 golang.org/x/net 包不能 发送 ping 或 接收 pong。并没有说包裹不会发pong。
golang.org/x/net 包通过向对等点发送 pong 来自动响应从对等点收到的 ping,Gorilla 包也是如此。这两个包都可以与使用 ping 和 pong 来保持连接的对等点一起正常工作。
使用 golang.org/x/net/websocket 包的应用程序不能使用 ping 和 pong 来保持连接。无法发送 ping。无法检测是否已收到乒乓球。