Documentation ¶
Overview ¶
Example ¶
gows.New("localhost", 8091, func(conn *gows.Conn) { // ping the client per 30 secs. conn.Ping(30, func(conn *gows.Conn) { fmt.Println("ping timeout.") }) for { data, err := conn.Read() if err != nil { if err == io.EOF { fmt.Println("Connection Close.") } break } fmt.Fprintf(conn, "hello, %s\n", string(data)) } }).Start()
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ( OpcodeExtraData = 0x00 OpcodeTextData = 0x01 OpcodeBinaryData = 0x02 OpcodeConnectionClose = 0x08 OpcodePing = 0x09 OpcodePong = 0x0A )
View Source
const ConnUUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptCallback ¶
type AcceptCallback func(conn *Conn)
type Conn ¶
func (*Conn) Ping ¶
Start to send keepalive data to client, It will ping client per (interval) seconds, the errCallback will be call when pong client didn't arrive in (interval) seconds, you can call CancelPing to cancel it.
Click to show internal directories.
Click to hide internal directories.