Documentation ¶
Index ¶
- Constants
- type Data
- type Event
- type Namespace
- type Option
- type OptionWith
- type Request
- type Room
- type Server
- type ServerV1
- func (v1 ServerV1) Emit(event Event, data ...Data) error
- func (v1 *ServerV1) In(room Room) inToEmit
- func (v1 *ServerV1) Of(ns Namespace) inSocketV1
- func (v1 ServerV1) On(event Event, callback eventCallback)
- func (v1 ServerV1) OnConnect(callback onConnectCallbackVersion1)
- func (v1 ServerV1) OnDisconnect(callback func(string))
- func (v1 *ServerV1) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (v1 *ServerV1) To(room Room) inToEmit
- func (v1 *ServerV1) With(opts ...Option)
- type ServerV2
- func (v2 ServerV2) Emit(event Event, data ...Data) error
- func (v2 *ServerV2) In(room Room) inToEmit
- func (v2 *ServerV2) Of(ns Namespace) inSocketV2
- func (v2 ServerV2) On(event Event, callback eventCallback)
- func (v2 ServerV2) OnConnect(callback onConnectCallbackVersion2)
- func (v2 ServerV2) OnDisconnect(callback func(string))
- func (v2 *ServerV2) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (v2 *ServerV2) To(room Room) inToEmit
- func (v2 *ServerV2) With(opts ...Option)
- type ServerV3
- func (v3 ServerV3) Emit(event Event, data ...Data) error
- func (v3 *ServerV3) In(room Room) inToEmit
- func (v3 *ServerV3) Of(ns Namespace) inSocketV3
- func (v3 ServerV3) On(event Event, callback eventCallback)
- func (v3 ServerV3) OnConnect(callback onConnectCallbackVersion3)
- func (v3 ServerV3) OnDisconnect(callback func(string))
- func (v3 *ServerV3) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (v3 *ServerV3) To(room Room) inToEmit
- func (v3 *ServerV3) With(opts ...Option)
- type ServerV4
- func (v4 ServerV4) Emit(event Event, data ...Data) error
- func (v4 *ServerV4) Except(room ...Room) innTooExceptEmit
- func (v4 *ServerV4) In(room ...Room) innTooExceptEmit
- func (v4 *ServerV4) Of(namespace Namespace) inSocketV4
- func (v4 ServerV4) On(event Event, callback eventCallback)
- func (v4 ServerV4) OnConnect(callback onConnectCallbackVersion4)
- func (v4 ServerV4) OnDisconnect(callback func(string))
- func (v4 *ServerV4) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (v4 *ServerV4) To(room ...Room) innTooExceptEmit
- func (v4 *ServerV4) With(opts ...Option)
- type SessionID
- type SocketID
- type SocketV1
- func (v1 *SocketV1) Broadcast() emit
- func (v1 *SocketV1) Compress(compress bool) broadcastEmit
- func (v1 *SocketV1) Emit(event Event, data ...Data) error
- func (v1 *SocketV1) ID() SocketID
- func (v1 SocketV1) In(room Room) inToEmit
- func (v1 *SocketV1) Join(room Room) error
- func (v1 *SocketV1) Leave(room Room) error
- func (v1 SocketV1) Of(namespace Namespace) inSocketV1
- func (v1 SocketV1) On(event Event, callback eventCallback)
- func (v1 SocketV1) OnConnect(callback onConnectCallbackVersion1)
- func (v1 SocketV1) OnDisconnect(callback func(string))
- func (v1 *SocketV1) Request() *Request
- func (v1 SocketV1) To(room Room) inToEmit
- func (v1 *SocketV1) Volatile() broadcastEmit
- type SocketV2
- func (v2 *SocketV2) Binary(binary bool) emit
- func (v2 *SocketV2) Broadcast() emit
- func (v2 *SocketV2) Compress(compress bool) emit
- func (v2 *SocketV2) Emit(event Event, data ...Data) error
- func (v2 *SocketV2) ID() SocketID
- func (v2 SocketV2) In(room Room) inToEmit
- func (v2 *SocketV2) Join(room Room) error
- func (v2 *SocketV2) Leave(room Room) error
- func (v2 SocketV2) Of(namespace Namespace) inSocketV2
- func (v2 SocketV2) On(event Event, callback eventCallback)
- func (v2 SocketV2) OnConnect(callback onConnectCallbackVersion2)
- func (v2 SocketV2) OnDisconnect(callback func(string))
- func (v2 *SocketV2) Request() *Request
- func (v2 SocketV2) To(room Room) inToEmit
- func (v2 *SocketV2) Volatile() emit
- type SocketV3
- func (v3 *SocketV3) Broadcast() emit
- func (v3 *SocketV3) Compress(compress bool) emit
- func (v3 *SocketV3) Emit(event Event, data ...Data) error
- func (v3 *SocketV3) ID() SocketID
- func (v3 SocketV3) In(room Room) inToEmit
- func (v3 *SocketV3) Join(room Room) error
- func (v3 *SocketV3) Leave(room Room) error
- func (v3 SocketV3) Of(namespace Namespace) inSocketV3
- func (v3 SocketV3) On(event Event, callback eventCallback)
- func (v3 SocketV3) OnConnect(callback onConnectCallbackVersion3)
- func (v3 SocketV3) OnDisconnect(callback func(string))
- func (v3 *SocketV3) Request() *Request
- func (v3 SocketV3) To(room Room) inToEmit
- func (v3 *SocketV3) Volatile() emit
- type SocketV4
- func (v4 *SocketV4) Broadcast() emit
- func (v4 *SocketV4) Compress(compress bool) emit
- func (v4 *SocketV4) Emit(event Event, data ...Data) error
- func (v4 SocketV4) Except(rooms ...Room) innTooExceptEmit
- func (v4 *SocketV4) Handshake() handshakeV4
- func (v4 *SocketV4) ID() SocketID
- func (v4 SocketV4) In(rooms ...Room) innTooExceptEmit
- func (v4 *SocketV4) Join(room Room) error
- func (v4 *SocketV4) Leave(room Room) error
- func (v4 SocketV4) Of(namespace Namespace) inSocketV4
- func (v4 SocketV4) On(event Event, callback eventCallback)
- func (v4 SocketV4) OnConnect(callback onConnectCallbackVersion4)
- func (v4 SocketV4) OnDisconnect(callback func(string))
- func (v4 *SocketV4) Request() *Request
- func (v4 *SocketV4) Timeout(dur time.Duration) emit
- func (v4 SocketV4) To(rooms ...Room) innTooExceptEmit
- func (v4 *SocketV4) Volatile() emit
Constants ¶
const ( ErrScrubFailed erro.StringF = "failed to scrub string:: %w" ErrFromRoomFailed erro.StringF = "failed to get socket ids from room:: %w" ErrUnknownEventName erro.String = "unknown event name, the first field is not a string" ErrUnknownBinaryEventName erro.StringF = "unknown event name, expected a string but found %v (%[1]T)" ErrUnsupportedEventName erro.StringF = "event name unsupported, cannot use the registered name %q as an event name" ErrUnexpectedData erro.StringF = "expected an []interface{} or []string, found %T" ErrUnexpectedBinaryData erro.StringF = "expected an []interface{} (binary array) or []string, found %T" ErrUnexpectedPacketType erro.StringF = "unexpected %T" ErrNamespaceNotFound erro.StringF = "namespace %q not found" ErrOnConnectSocket erro.State = "socket: invalid onconnect" ErrOnDisconnectSocket erro.State = "socket: invalid ondisconnect" )
const (
OnDisconnectEvent = "disconnect"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data = seri.Serializable
type OptionWith ¶
type OptionWith = with.OptionWith
type Request ¶
type Request struct { Method string URL *url.URL Header http.Header Host string RemoteAddr string RequestURI string // contains filtered or unexported fields }
Request is a wrapped HTTP request object so that we expose only the things that are necessary,
type Server ¶
type Server = interface {
ServeHTTP(http.ResponseWriter, *http.Request)
}
Server is the generic interface that's used to designate the socketID as a server so that it can be added to a http.Server instance.
type ServerV1 ¶
type ServerV1 struct {
// contains filtered or unexported fields
}
ServerV1 is the same as the javascript SocketIO v1.0 server.
func NewServerV1 ¶
NewServerV1 returns a new v1.0 SocketIO server
func (ServerV1) OnDisconnect ¶
func (v1 ServerV1) OnDisconnect(callback func(string))
type ServerV2 ¶
type ServerV2 struct {
// contains filtered or unexported fields
}
The 4th revision (included in socket.io@1.0.3...2.x.x) can be found here: https://github.com/socketio/socket.io-protocol/tree/v4
func NewServerV2 ¶
func (ServerV2) OnDisconnect ¶
func (v2 ServerV2) OnDisconnect(callback func(string))
type ServerV3 ¶
type ServerV3 struct {
// contains filtered or unexported fields
}
func NewServerV3 ¶
func (ServerV3) OnDisconnect ¶
func (v3 ServerV3) OnDisconnect(callback func(string))
type ServerV4 ¶
type ServerV4 struct {
// contains filtered or unexported fields
}
func NewServerV4 ¶
func (ServerV4) OnDisconnect ¶
func (v4 ServerV4) OnDisconnect(callback func(string))
type SessionID ¶
SocketID is am alias of a session id, so that we don't need to reference sessions through the package
type SocketV1 ¶
type SocketV1 struct { Connected bool // contains filtered or unexported fields }
SocketV1 is the returned socket
func (SocketV1) Of ¶
func (v1 SocketV1) Of(namespace Namespace) inSocketV1
Of - sending to all clients in namespace, including sender
func (SocketV1) OnDisconnect ¶
func (v1 SocketV1) OnDisconnect(callback func(string))
type SocketV2 ¶
type SocketV2 struct {
// contains filtered or unexported fields
}
func (SocketV2) OnDisconnect ¶
func (v2 SocketV2) OnDisconnect(callback func(string))
type SocketV3 ¶
type SocketV3 struct {
// contains filtered or unexported fields
}
func (SocketV3) In ¶
func (v3 SocketV3) In(room Room) inToEmit
In - sending to all clients in room, including sender
func (SocketV3) Of ¶
func (v3 SocketV3) Of(namespace Namespace) inSocketV3
Of - sending to all clients in namespace, including sender
func (SocketV3) OnDisconnect ¶
func (v3 SocketV3) OnDisconnect(callback func(string))
type SocketV4 ¶
type SocketV4 struct {
// contains filtered or unexported fields
}
func (SocketV4) Except ¶
func (v4 SocketV4) Except(rooms ...Room) innTooExceptEmit
Except - sending to all clients in room, except sender
func (SocketV4) In ¶
func (v4 SocketV4) In(rooms ...Room) innTooExceptEmit
In - sending to all clients in room, including sender
func (SocketV4) Of ¶
func (v4 SocketV4) Of(namespace Namespace) inSocketV4
Of - sending to all clients in namespace, including sender
func (SocketV4) OnDisconnect ¶
func (v4 SocketV4) OnDisconnect(callback func(string))
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
adaptor
|
|
internal
|
|
Package protocol provides a object representation of a socket.io packet.
|
Package protocol provides a object representation of a socket.io packet. |