Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func Connect(u url.URL, tr *websocket.Transport) (c *Client, err error)
- func ConnectContext(ctx context.Context, u url.URL, tr *websocket.Transport) (c *Client, err error)
- func DialOnly(u url.URL, tr *websocket.Transport) (c *Client, err error)
- func DialOnlyContext(ctx context.Context, u url.URL, tr *websocket.Transport) (c *Client, err error)
- func (c *Client) Ack(ctx context.Context, method string, args interface{}, ret interface{}) error
- func (c *Client) Close() error
- func (c *Client) Done() <-chan struct{}
- func (c *Client) Emit(method string, args ...interface{}) error
- func (c *Client) Err() error
- func (c *Client) ID() string
- func (c *Client) Listeners() (list []string)
- func (c *Client) Of(namespace string) (*Namespace, error)
- func (c *Client) Off(method string)
- func (c *Client) On(method string, f interface{}) error
- type ErrorArgument
- type ErrorInvalidInterface
- type ErrorNotFunction
- type Handler
- type Header
- type IncomingError
- type Namespace
- func (n *Namespace) Ack(ctx context.Context, method string, args interface{}, v interface{}) error
- func (n *Namespace) Emit(method string, args ...interface{}) error
- func (n *Namespace) Listeners() (list []string)
- func (n *Namespace) Off(method string)
- func (n *Namespace) On(method string, f interface{}) error
- func (n *Namespace) Ready() <-chan struct{}
Constants ¶
const ( // OnConnection for "connection" messages. OnConnection = protocol.OnConnection // OnDisconnect for "disconnect" messages. OnDisconnect = protocol.OnDisconnect // OnError for "error" messages. OnError = protocol.OnError )
Variables ¶
var ErrClosed = errors.New("socket.io connection closed")
ErrClosed is returned when something goes wrong because a connection was closed explicitly.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client to handle socket.io connections
func Connect ¶
Connect dials and waits for the "connection" event. It blocks for the timeout duration. If the connection is not established in time, it closes the connection and returns an error.
func ConnectContext ¶
ConnectContext dials and waits for the "connection" event. It blocks for the timeout duration. If the connection is not established in time, it closes the connection and returns an error.
func DialOnly ¶
DialOnly connects to the host and initializes the socket.io protocol. It doesn't wait for socket.io connection handshake. You probably want to use Connect instead. Only exposed for debugging.
func DialOnlyContext ¶
func DialOnlyContext(ctx context.Context, u url.URL, tr *websocket.Transport) (c *Client, err error)
DialOnlyContext connects to the host and initializes the socket.io protocol. It doesn't wait for socket.io connection handshake. You probably want to use Connect instead. Only exposed for debugging.
func (*Client) Close ¶
Close client connection. If the connection is closed this way, returns ErrClosed.
func (*Client) Done ¶
func (c *Client) Done() <-chan struct{}
Done returns a channel that's closed when this client connection is closed.
func (*Client) Err ¶
Err returns why a client connection is closed. If Done is not closed, it returns nil.
type ErrorArgument ¶
type ErrorArgument struct {
// contains filtered or unexported fields
}
ErrorArgument is used when trying to create a non-function listener with an invalid parameter
func (ErrorArgument) Error ¶
func (e ErrorArgument) Error() string
type ErrorInvalidInterface ¶
type ErrorInvalidInterface struct {
// contains filtered or unexported fields
}
func (ErrorInvalidInterface) Error ¶
func (e ErrorInvalidInterface) Error() string
func (ErrorInvalidInterface) Method ¶
func (e ErrorInvalidInterface) Method() string
type ErrorNotFunction ¶
type ErrorNotFunction struct {
// contains filtered or unexported fields
}
ErrorNotFunction is used when trying to create a non-function listener
func (ErrorNotFunction) Error ¶
func (e ErrorNotFunction) Error() string
type Handler ¶
type Handler struct { Func reflect.Value Out bool Variadic bool // contains filtered or unexported fields }
Handler for the message
func NewHandler ¶
NewHandler creates a new listener
type Header ¶
type Header struct { Sid string `json:"sid"` Upgrades []string `json:"upgrades"` PingInterval int `json:"pingInterval"` PingTimeout int `json:"pingTimeout"` }
Header of engine.io to send and receive packets
type IncomingError ¶
type IncomingError struct { Namespace string Object json.RawMessage }
IncomingError handles socket.io incoming errors.
func (IncomingError) Error ¶
func (i IncomingError) Error() string
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace for the connection.
func NewNamespace ¶
NewNamespace creates a namespace.