示例#1
0
文件: app.go 项目: mrlauer/socket
func socketHandler(inst *wsock.SocketInstance, length int64, data io.Reader) error {
	d := make([]byte, length)
	data.Read(d)
	fmt.Printf("Message: %q\n", d)
	inst.Write(d)
	return nil
}
示例#2
0
文件: app.go 项目: mrlauer/socket
func socketConnectionHandler(inst *wsock.SocketInstance) error {
	err := inst.ReadLoop()
	fmt.Printf("connection closed %q\n", err)
	return err
}