1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 18:00:49 +00:00

Merge pull request #1247 from Skycrab/develop

fix example/chat i/o timeout
This commit is contained in:
astaxie 2015-08-23 22:18:38 +08:00
commit 437349f776

View File

@ -54,14 +54,13 @@ func (c *connection) readPump() {
}()
c.ws.SetReadLimit(maxMessageSize)
c.ws.SetReadDeadline(time.Now().Add(readWait))
c.ws.SetPongHandler(func(string) error { c.ws.SetReadDeadline(time.Now().Add(readWait)); return nil })
for {
op, r, err := c.ws.NextReader()
if err != nil {
break
}
switch op {
case websocket.PongMessage:
c.ws.SetReadDeadline(time.Now().Add(readWait))
case websocket.TextMessage:
message, err := ioutil.ReadAll(r)
if err != nil {