overflow_service_websocket/server/connection.go

35 lines
1.0 KiB
Go
Raw Normal View History

2017-07-13 12:01:28 +00:00
package server
2017-07-12 12:36:12 +00:00
import (
"io"
"net"
"time"
)
// Connection is wrapper of the websocket.Conn
type Connection interface {
Close() error
CloseHandler() func(code int, text string) error
EnableWriteCompression(enable bool)
LocalAddr() net.Addr
NextReader() (messageType int, r io.Reader, err error)
NextWriter(messageType int) (io.WriteCloser, error)
PingHandler() func(appData string) error
PongHandler() func(appData string) error
ReadJSON(v interface{}) error
ReadMessage() (messageType int, p []byte, err error)
RemoteAddr() net.Addr
SetCloseHandler(h func(code int, text string) error)
SetCompressionLevel(level int) error
SetPingHandler(h func(appData string) error)
SetPongHandler(h func(appData string) error)
SetReadDeadline(t time.Time) error
SetReadLimit(limit int64)
SetWriteDeadline(t time.Time) error
Subprotocol() string
UnderlyingConn() net.Conn
WriteControl(messageType int, data []byte, deadline time.Time) error
WriteJSON(v interface{}) error
WriteMessage(messageType int, data []byte) error
}