Skip to content

Commit

Permalink
Merge pull request #672 from c4dt/streaming_do-not-error-on-close
Browse files Browse the repository at this point in the history
websocket: do not error on service's close
  • Loading branch information
nkcr authored Jan 27, 2021
2 parents 3f25c1c + 1ad1b87 commit 3329440
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,11 @@ outerReadLoop:
break outerReadLoop
case reply, ok := <-outChan:
if !ok {
err = xerrors.New("service finished streaming")
ws.WriteControl(websocket.CloseMessage,
websocket.FormatCloseMessage(websocket.CloseNormalClosure, "service finished streaming"),
time.Now().Add(time.Millisecond*500))
close(clientInputs)
break outerReadLoop
return
}
tx += len(reply)

Expand Down

0 comments on commit 3329440

Please sign in to comment.