Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to send data to other conn? #78

Open
zzxap opened this issue Jul 31, 2023 · 0 comments
Open

how to send data to other conn? #78

zzxap opened this issue Jul 31, 2023 · 0 comments

Comments

@zzxap
Copy link

zzxap commented Jul 31, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant