1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00
Former-commit-id: fe6305deed00e170bf4d39a12c0644fe686e0a24
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-10-21 19:20:05 +03:00
parent dbba631df4
commit 3962710d3d
109 changed files with 4383 additions and 2658 deletions

View File

@@ -2,6 +2,7 @@ package websocket
import (
"bytes"
"errors"
"io"
"net"
"strconv"
@@ -580,7 +581,14 @@ func (c *connection) Wait() {
c.startReader()
}
// ErrAlreadyDisconnected can be reported on the `Connection#Disconnect` function whenever the caller tries to close the
// connection when it is already closed by the client or the caller previously.
var ErrAlreadyDisconnected = errors.New("already disconnected")
func (c *connection) Disconnect() error {
if c == nil || c.disconnected {
return ErrAlreadyDisconnected
}
return c.server.Disconnect(c.ID())
}