Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn interface { FrameReader FrameWriter io.Closer URL() url.URL LocalAddr() net.Addr RemoteAddr() net.Addr RemoteHeader() http.Header SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error }
Conn is a connection.
type ConnParameters ¶
type ConnParameters struct { PingInterval time.Duration PingTimeout time.Duration SID string Upgrades []string }
ConnParameters is connection parameter of server.
func ReadConnParameters ¶
func ReadConnParameters(r io.Reader) (ConnParameters, error)
ReadConnParameters reads ConnParameters from r.
type FrameReader ¶
type FrameReader interface {
NextReader() (FrameType, PacketType, io.ReadCloser, error)
}
FrameReader reads a frame. It need be closed before next reading.
type FrameType ¶
type FrameType byte
FrameType is the type of frames.
func ByteToFrameType ¶
ByteToFrameType converts a byte to FrameType.
type FrameWriter ¶
type FrameWriter interface {
NextWriter(ft FrameType, pt PacketType) (io.WriteCloser, error)
}
FrameWriter writes a frame. It need be closed before next writing.
type OpError ¶
OpError is the error type usually returned by functions in the transport package.
type PacketType ¶
type PacketType int
PacketType is the type of packet
const ( // OPEN is sent from the server when a new transport is opened (recheck). OPEN PacketType = iota // CLOSE is request the close of this transport but does not shutdown the // connection itself. CLOSE // PING is sent by the client. Server should answer with a pong packet // containing the same data. PING // PONG is sent by the server to respond to ping packets. PONG // MESSAGE is actual message, client and server should call their callbacks // with the data. MESSAGE // UPGRADE is sent before engine.io switches a transport to test if server // and client can communicate over this transport. If this test succeed, // the client sends an upgrade packets which requests the server to flush // its cache on the old transport and switch to the new transport. UPGRADE // NOOP is a noop packet. Used primarily to force a poll cycle when an // incoming websocket connection is received. NOOP )
func ByteToPacketType ¶
func ByteToPacketType(b byte, typ FrameType) PacketType
ByteToPacketType converts a byte to PacketType.
func (PacketType) BinaryByte ¶
func (id PacketType) BinaryByte() byte
BinaryByte converts a PacketType to byte in binary.
func (PacketType) String ¶
func (id PacketType) String() string
func (PacketType) StringByte ¶
func (id PacketType) StringByte() byte
StringByte converts a PacketType to byte in string.
Click to show internal directories.
Click to hide internal directories.