-
Notifications
You must be signed in to change notification settings - Fork 83
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
[Based on #195 but zero-copy] Log ws message on parsing error to Message enum #204
Conversation
src/conn.rs
Outdated
// ignore pings | ||
Poll::Pending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might still have more work to do so we either need to wake here before returning pending are put the ws poll in a loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, i've fixed it!
Is it safe to ignore the bytes and frames though? |
Ignoring Frame is safe because we should not get it when reading a message as snapview/tungstenite-rs#250. IMO ignoring Bytes is also safe because cdp is a JSON-based protocol and I suppose it uses only the text type of frame. |
CDP actually can stream the responses - which would suggest using the advanced websocket capabilities - but I checked and it indeed only uses text with data embedded as base64. See: |
As the title, this is based on #195, but zero-copy.
Also, it changes from doing
serde_json::from_slice(&data.into_data())
to doingserde_json::from_str(&text)
ofWsMessage::Text(text)
. Other variants ofWsMessage
are handled as follows:Ping
andPong
: IgnoredBytes
andFrames
: IgnoredClose
: Ends the stream