Skip to content

how to send data to other conn? #78

@zzxap

Description

@zzxap

events.Data = func(c evio.Conn, in []byte) (out []byte, action evio.Action) {
fmt.Println("events.Data ")
if in == nil {
//how to know is close action?
fmt.Println("in is nil Closed")
action = evio.Close
return

	} else {
                 // how to send data????????
		fmt.Println("dataToSend ")
		//dataToSend := c.Context().([]byte)
		//if dataToSend != nil {
		//	out = append(out, dataToSend...)
		//	return
		//}
	}

	fmt.Println("ReceiveData ")
	fmt.Println(string(in))
	toConn, _ := getconnByJsonData(c, in)
	if toConn != nil {
		fmt.Println("send Data ")
		toConn.SetContext(in)
		toConn.Wake()
	}

	return
} 

I save conn in a map userid->conn
and get it by getconnByJsonData(c, in)
how to send data to other conn?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions