-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(socketioxide): properly send binary payloads embedded in structs
In order to reduce possible API-use confusion, ConfOperators and BroadcastOperators now has a new type param, for a new (sealed) trait, BinaryHolding, which "tells" the struct whether or not the user has added binary data or not. If the user has not added binary data, the operator will be WithoutBinary, and emit() and emit_with_ack() take a T: Serialize as usual, and those methods will attempt to extract any binary payloads from the user-provided struct before sending the event. If the user explicitly adds binary data (by calling the bin() method), they will get back a new instance of the operator that is WithBinary. Then the emit() and emit_with_ack() methods will take a serde_json::Value, which is expected to already have placeholder objects where any binary payload is supposed to be.
- Loading branch information
Showing
6 changed files
with
418 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.