我想了解有关websocket握手超时的一些见解。在此之前,我使用HandshakeTimeout
从我的WebSocket收到了此错误,并将其设置为10 seconds
。
websocket: close 1006 (abnormal closure): unexpected EOF
我试图找到解决该错误的方法,许多小组说要增加HandshakeTimeout
。
但是,我的想法与众不同,并且想要像这样设置config websocket:
ws := websocket.Upgrader{
ReadBufferSize: 0,
WriteBufferSize: 0,
HandshakeTimeout: 0,
CheckOrigin: func(r *nethttp.Request) bool {
return true
},
}
我的问题是。如果将HandshakeTimeout
设置为0
,会出现任何漏洞问题或负面问题吗?
我正在使用gorilla在代码中设置websocket。
答案 0 :(得分:0)
值为零时没有超时。如果没有超时,则可以将与连接关联的资源(包括goroutine)保留任意时间。