Example #1
0
func helloHandler(client *pillx.Response, protocol pillx.IProtocol) {
	fmt.Println("test3")
	req := protocol.(*pillx.GateWayProtocol)
	fmt.Printf("%x", req.Header)
	fmt.Printf("%s", req.Content)
	req.Content = []byte("user" + strconv.FormatUint(req.Header.ClientId, 10) + ":  " + string(req.Content) + "\r\n")
	req.Header.Size = uint16(len(req.Content))
	client.Send(req)
}
Example #2
0
func helloHandler(client *pillx.Response, req pillx.IProtocol) {
	//fmt.Print(string(req.Content))
	//
	client.Send(req)
	//io.WriteString(client, "World")

	channel := pillx.NewChannel("all")
	channel.Subscribe(client)
	channel.Publish(req)
}