TrackMessageSizeInterceptor: Allow for delimiter character in message content
Currently , if the message contains a character that's set as a message delimiter, it breaks the delivery.
A possible solution would be to encode the payload in the interceptor, for example to Base64, and then decode it in the client.
@nite23 Would that perform well in terms of speed? You are aware you can change the delimiter default char right? At work we came with a list of char for wsj.com and so far it always worked.
Not too much slower, I guess, since we were already decoding the message to utf-8 to figure out it's length in characters and then re-encoding it again. There will be some overhead on messsage size, though (that could be fixed by using a more efficient encoding scheme).
But it might be worth it for people who don't want to bother with validating input data for delimiters.
https://gist.github.com/4238566 Here's an interceptor to test the concept. Client-side decoding is done in onMessage callback.
Base64 encoding will increase the size of the encoded string by 30%
@staabm I like it. Can you do a request so I can add it to the distribution?
@nite23 Do me a favor and do a pull request with your implementation. I will take care of documenting it. Thanks!
@jfarcand done!
@nite23 Do you use TrackMessageSizeB64Interceptor with the atmosphere-javascript client? I'm having problems with WebSocket and SSE when I use it. The initial message with [tracking ID]|[timestamp] is also base64 encoded, and therefore the js client doesn't understand it. It thinks the length before the | character is the tracking ID and the base64 part after | is the timestamp. Any suggestions? Using Atmosphere 2.0.2 at the moment.