Documentation ¶
Index ¶
- Constants
- func GenerateID() (string, error)
- type Broadcaster
- type Config
- type ConnectHandlerFunc
- type MessageHandlerFunc
- type ReadyState
- type RequestError
- type Server
- func (s *Server) HandleUpgrade(query url.Values, w http.ResponseWriter, r *http.Request)
- func (s *Server) Handshake(query url.Values, w http.ResponseWriter, r *http.Request)
- func (s *Server) OnConnection(handlerFunc ConnectHandlerFunc)
- func (s *Server) OnMessage(handlerFunc MessageHandlerFunc)
- func (s *Server) SendError(w http.ResponseWriter, r *http.Request, errCode int)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) VerifyRequest(query url.Values, r *http.Request, upgrade bool) (bool, int)
- type Socket
- type UpgradeState
Constants ¶
View Source
const ( UnknownTransport = iota UnknownSid BadHandshakeMethod BadRequest Forbidden )
Variables ¶
This section is empty.
Functions ¶
func GenerateID ¶
Types ¶
type Broadcaster ¶
type Broadcaster struct { Publisher chan<- interface{} // contains filtered or unexported fields }
type ConnectHandlerFunc ¶
type ConnectHandlerFunc func(socket *Socket)
type MessageHandlerFunc ¶
type ReadyState ¶
type ReadyState int
const ( ReadyStateOpening ReadyState = iota ReadyStateOpen ReadyStateClosing ReadyStateClosed )
type RequestError ¶
type Server ¶
type Server struct { MsgHandler MessageHandlerFunc ConnectHandler ConnectHandlerFunc Path string PingInterval time.Duration PingTimeout time.Duration //poll MaxHttpBufferSize uint64 HttpCompression bool PerMessageDeflate bool // contains filtered or unexported fields }
func (*Server) HandleUpgrade ¶
func (*Server) OnConnection ¶
func (s *Server) OnConnection(handlerFunc ConnectHandlerFunc)
func (*Server) OnMessage ¶
func (s *Server) OnMessage(handlerFunc MessageHandlerFunc)
if sync is set the message handler gets called in a synchronized manner so you don't have to synchronize access to data.
type Socket ¶
type Socket struct { Id string Transport transport.ITransport // contains filtered or unexported fields }
func (*Socket) HandleTransport ¶
func (s *Socket) HandleTransport(transport transport.ITransport, upgrading bool)
func (*Socket) SendMessage ¶
type UpgradeState ¶
type UpgradeState int
const ( UpgradeStateNone UpgradeState = iota UpgradeStateUpgrading UpgradeStateUpgraded )
Click to show internal directories.
Click to hide internal directories.