Documentation ¶
Index ¶
- func ServerOptions() *options
- type Client
- func (c *Client) Close()
- func (c *Client) NextReader() (messageType int, r io.Reader, err error)
- func (c *Client) NextWriterBinary() (r io.Writer, err error)
- func (c *Client) NextWriterText() (r io.Writer, err error)
- func (c *Client) SetOnClose(fn func(err error)) *Client
- func (c *Client) SetOnError(fn func(err error)) *Client
- func (c *Client) SetRawHandler(fn func(message []byte)) *Client
- func (c *Client) SetRawMiddleware(fn func(message []byte)) *Client
- func (c *Client) SetUpdateTypeHandler(updateType string, fn func(message json.RawMessage)) *Client
- func (w Client) WriteBinaryBytes(data []byte) (err error)
- func (w Client) WriteBinaryText(data []byte) (err error)
- func (w Client) WriteRawUpdate(data interface{}) (err error)
- func (w Client) WriteText(data string) (err error)
- func (w Client) WriteUpdate(updateType string, data interface{}) (err error)
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) Errors() <-chan error
- func (c *Connection) GetAttribute(key string) (val interface{}, exists bool)
- func (c *Connection) HandleRawUpdate(handler func(message []byte))
- func (c *Connection) HandleUpdate(updateType string, handler func(message json.RawMessage))
- func (c *Connection) ID() string
- func (c *Connection) InternalUpdates() <-chan []byte
- func (c *Connection) NextReader() (messageType int, r io.Reader, err error)
- func (c *Connection) NextWriterBinary() (r io.Writer, err error)
- func (c *Connection) NextWriterCloseMessage() (r io.Writer, err error)
- func (c *Connection) NextWriterText() (r io.Writer, err error)
- func (c *Connection) ProcessUpdates() error
- func (c *Connection) Server() *Server
- func (c *Connection) SetAttribute(key string, val interface{})
- func (c *Connection) SetKeepAliveDuration(keepAlive time.Duration)
- func (c *Connection) SetMiddleware(middleware func(message []byte) error)
- func (c *Connection) SetOnClose(onClose func())
- func (c *Connection) SetUpdateTypeMiddleware(middleware func(updateType string, data json.RawMessage) error)
- func (c *Connection) UpgradeRequest() *http.Request
- func (w Connection) WriteBinaryBytes(data []byte) (err error)
- func (w Connection) WriteBinaryText(data []byte) (err error)
- func (c *Connection) WriteInternalUpdate(update []byte)
- func (w Connection) WriteRawUpdate(data interface{}) (err error)
- func (w Connection) WriteText(data string) (err error)
- func (w Connection) WriteUpdate(updateType string, data interface{}) (err error)
- type Logger
- type Server
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServerOptions ¶ added in v0.3.0
func ServerOptions() *options
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NextReader ¶ added in v0.3.7
func (*Client) NextWriterBinary ¶ added in v0.3.10
func (*Client) NextWriterText ¶ added in v0.3.10
func (*Client) SetOnClose ¶ added in v0.1.9
func (*Client) SetOnError ¶ added in v0.3.0
func (*Client) SetRawHandler ¶ added in v0.3.0
func (*Client) SetRawMiddleware ¶ added in v0.3.4
func (*Client) SetUpdateTypeHandler ¶ added in v0.3.0
func (c *Client) SetUpdateTypeHandler(updateType string, fn func(message json.RawMessage)) *Client
func (Client) WriteBinaryBytes ¶ added in v0.2.5
func (Client) WriteBinaryText ¶ added in v0.2.7
func (Client) WriteRawUpdate ¶ added in v0.1.4
func (w Client) WriteRawUpdate(data interface{}) (err error)
func (Client) WriteUpdate ¶
type Connection ¶ added in v0.2.9
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Close ¶ added in v0.2.9
func (c *Connection) Close() error
func (*Connection) Errors ¶ added in v0.2.9
func (c *Connection) Errors() <-chan error
func (*Connection) GetAttribute ¶ added in v0.2.9
func (c *Connection) GetAttribute(key string) (val interface{}, exists bool)
func (*Connection) HandleRawUpdate ¶ added in v0.2.9
func (c *Connection) HandleRawUpdate(handler func(message []byte))
HandleRawUpdate registers a default handler for update Note: Add a raw handler if you don't want to follow the API convention {"type": "", "data": {}}
func (*Connection) HandleUpdate ¶ added in v0.2.9
func (c *Connection) HandleUpdate(updateType string, handler func(message json.RawMessage))
HandleUpdate registers a default handler for updateType Care: If you use this method for an updateType, you won't receive the respected update in your listener
func (*Connection) ID ¶ added in v0.2.9
func (c *Connection) ID() string
func (*Connection) InternalUpdates ¶ added in v0.2.9
func (c *Connection) InternalUpdates() <-chan []byte
func (*Connection) NextReader ¶ added in v0.3.8
func (c *Connection) NextReader() (messageType int, r io.Reader, err error)
func (*Connection) NextWriterBinary ¶ added in v0.3.11
func (c *Connection) NextWriterBinary() (r io.Writer, err error)
func (*Connection) NextWriterCloseMessage ¶ added in v0.3.11
func (c *Connection) NextWriterCloseMessage() (r io.Writer, err error)
func (*Connection) NextWriterText ¶ added in v0.3.11
func (c *Connection) NextWriterText() (r io.Writer, err error)
func (*Connection) ProcessUpdates ¶ added in v0.2.9
func (c *Connection) ProcessUpdates() error
func (*Connection) Server ¶ added in v0.2.9
func (c *Connection) Server() *Server
func (*Connection) SetAttribute ¶ added in v0.2.9
func (c *Connection) SetAttribute(key string, val interface{})
func (*Connection) SetKeepAliveDuration ¶ added in v0.2.9
func (c *Connection) SetKeepAliveDuration(keepAlive time.Duration)
func (*Connection) SetMiddleware ¶ added in v0.2.9
func (c *Connection) SetMiddleware(middleware func(message []byte) error)
func (*Connection) SetOnClose ¶ added in v0.2.9
func (c *Connection) SetOnClose(onClose func())
func (*Connection) SetUpdateTypeMiddleware ¶ added in v0.2.9
func (c *Connection) SetUpdateTypeMiddleware(middleware func(updateType string, data json.RawMessage) error)
func (*Connection) UpgradeRequest ¶ added in v0.2.9
func (c *Connection) UpgradeRequest() *http.Request
func (Connection) WriteBinaryBytes ¶ added in v0.2.9
func (Connection) WriteBinaryText ¶ added in v0.2.9
func (*Connection) WriteInternalUpdate ¶ added in v0.2.9
func (c *Connection) WriteInternalUpdate(update []byte)
func (Connection) WriteRawUpdate ¶ added in v0.2.9
func (w Connection) WriteRawUpdate(data interface{}) (err error)
func (Connection) WriteUpdate ¶ added in v0.2.9
type Server ¶ added in v0.2.9
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Connections ¶ added in v0.3.11
func (s *Server) Connections() chan *Connection
type Update ¶
type Update struct { Type string `json:"type"` Data json.RawMessage `json:"data,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.