Documentation ¶
Index ¶
- type BufferPoolKey
- type CheckOriginKey
- type Connection
- type ErrorKey
- type Option
- func WithCheckOrigin(checkOrigin func(r *http.Request) bool) Option
- func WithEnableCompression(enableCompression bool) Option
- func WithError(err func(w http.ResponseWriter, r *http.Request, status int, reason error)) Option
- func WithHandshakeTimeout(handshakeTimeout time.Duration) Option
- func WithReadBufferSize(readBuffSize int) Option
- func WithSubprotocols(subProtocols []string) Option
- func WithWriteBufferPool(writeBufferPool websocket.BufferPool) Option
- func WithWriteBufferSize(writeBuffSize int) Option
- type Options
- type ReadMessage
- type Websocket
- func (ws *Websocket) AddConnection(key interface{}, conn *Connection)
- func (ws *Websocket) Exist(key interface{}) bool
- func (ws *Websocket) GetConnection(key interface{}) (*Connection, bool)
- func (ws *Websocket) Provide(ctx context.Context) interface{}
- func (ws *Websocket) RemoveConnection(key interface{})
- func (ws *Websocket) Upgrade(key interface{}, w http.ResponseWriter, r *http.Request, ...) (*Connection, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferPoolKey ¶
type BufferPoolKey struct{}
type CheckOriginKey ¶
type CheckOriginKey struct{}
type Connection ¶
type Connection struct { Socket *websocket.Conn ChRead chan *ReadMessage ChWrite chan interface{} IsClosed bool ChClose chan struct{} }
func (*Connection) Close ¶
func (conn *Connection) Close() error
func (*Connection) Read ¶
func (conn *Connection) Read() *ReadMessage
func (*Connection) ReadLoop ¶
func (conn *Connection) ReadLoop()
func (*Connection) Write ¶
func (conn *Connection) Write(data interface{})
func (*Connection) WriteLoop ¶
func (conn *Connection) WriteLoop()
type Option ¶
type Option func(*Options)
func WithEnableCompression ¶
func WithHandshakeTimeout ¶
func WithReadBufferSize ¶
func WithSubprotocols ¶
func WithWriteBufferPool ¶
func WithWriteBufferPool(writeBufferPool websocket.BufferPool) Option
func WithWriteBufferSize ¶
type ReadMessage ¶
type Websocket ¶
type Websocket struct {
// contains filtered or unexported fields
}
func (*Websocket) AddConnection ¶
func (ws *Websocket) AddConnection(key interface{}, conn *Connection)
func (*Websocket) GetConnection ¶
func (ws *Websocket) GetConnection(key interface{}) (*Connection, bool)
func (*Websocket) RemoveConnection ¶
func (ws *Websocket) RemoveConnection(key interface{})
Click to show internal directories.
Click to hide internal directories.