Closed bigsur0 closed 8 years ago
What do you mean by the "raw payload" exactly?
Basically "message.data" to be preserved in an extra field within the *Event Structs in addition to the "payload". My goal is to proxy some traffic through relatively untouched with at most permessage_deflate being applied. So quasi-raw after all...
I think this out of scope, partly because the question of what the "raw payload" is has no general definition; it depends very much on your use case. It might mean the masked message, unmasked message before extensions, the message after some or all extensions, or the data of individual frames, depending on what you want to do.
It would be hard to add something like this without holding onto large chunks of data that we currently let go of once they're processed, or without introducing breaking changes in future releases. I think that if you're implementing a proxy, you either use this library and you proxy completely decodes and reencodes messages between peers, or you're working at a level of abstraction beneath what we provide here and you should implement it yourself.
Can I close this issue?
I think you can close this. If I can always re-open another issue if I look at the code and think an implementation in websocket-driver-ruby makes sense.
Thanks for looking into this.
Would it be possible to preserve and expose the "raw" payload as a part of emit_message processing? The payload either gets encoded for converted to a byte array in this method, it would be nice to have a handle on the raw payload. Are there downsides to exposing the raw payload?
Relevant code snippets below.