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

feat: add ReadMessageAsync interface #687

Closed
wants to merge 0 commits into from

Conversation

iluozhiqiang
Copy link

Fixes #

Summary of Changes

  1. add ReadMessageAsync interface, can be used non-blocking scenarios such as epoll

PS: Make sure your PR includes/updates tests! If you need help with this part, just ask!

@ghost
Copy link

ghost commented May 12, 2021

Explain in words how ReadMessageAsync is different from ReadMessage.

The only difference that I can see is that ReadMessageAsync does not panic on repeated reads on a failed connection.

@iluozhiqiang
Copy link
Author

Thank you for your reply.
I want to use epoll events to read messages instead of blocking reading.
Maybe I need a another implement

@iluozhiqiang iluozhiqiang reopened this May 13, 2021
@ghost
Copy link

ghost commented May 13, 2021

I understand that you want to use epoll. Describe how this PR accomplishes that goal. What is the change in ReadMessageAsync that enables epoll? I'm not seeing it.

@iluozhiqiang
Copy link
Author

but ReadMessage Method only read Text and Binary.
However I need ReadMessage not wait Text And Binary.
I need non-bloking read all message with the framework,
because need while read all connections

conns, err := m.poller.Wait(128)
for _, rawConn := range conns {
	conn := rawConn.(*Conn)
	//
	conn.socket.ReadMessage()
}

@ghost
Copy link

ghost commented May 13, 2021

Please help us understand how this code enables non-blocking read. As far as I can tell, the code blocks on read:

Issue #481 is about enabling non-blocking read. Give a thumbs up there in support of that feature request.

@iluozhiqiang
Copy link
Author

Sorry, my pull request was too sloppy, I'm need thinking better about it

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

Successfully merging this pull request may close these issues.

1 participant