-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SignalR] Don't throw for message headers in Java client #62739
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -139,7 +139,14 @@ public List<HubMessage> parseMessages(ByteBuffer payload, InvocationBinder binde | |||||||||||||||||||||||
} | ||||||||||||||||||||||||
break; | ||||||||||||||||||||||||
case "headers": | ||||||||||||||||||||||||
throw new RuntimeException("Headers not implemented yet."); | ||||||||||||||||||||||||
// Parse headers as Map<String, String> but don't store for now as it's unused | ||||||||||||||||||||||||
reader.beginObject(); | ||||||||||||||||||||||||
while (reader.hasNext()) { | ||||||||||||||||||||||||
reader.nextName(); // Read the key | ||||||||||||||||||||||||
reader.nextString(); // Read the value | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
reader.endObject(); | ||||||||||||||||||||||||
Comment on lines
+142
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can simplify skipping the entire headers object by using
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a Java expert but I looked up this API and it seems like JsonReader.skipValue is a better way to skip processing the entire "headers" object. Is there a reason we aren't using it here, especially if the value isn't stored? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ye, seems a nice API to use here. also as Brennan explained in one of the issue comments headers are parsed in MessagePack - but they are used later: Line 194 in 36e93fa
Line 224 in 36e93fa
why do we completely ignore them here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
They aren't really used. We set them on the messages but don't actually use them.
It doesn't really matter what we do here, but I do like the current code since it technically validates the json is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense, approved. |
||||||||||||||||||||||||
break; | ||||||||||||||||||||||||
default: | ||||||||||||||||||||||||
// Skip unknown property, allows new clients to still work with old protocols | ||||||||||||||||||||||||
reader.skipValue(); | ||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.