Module | EventMachine::Protocols::LineText2 |
In: |
lib/em/protocols/linetext2.rb
|
In the grand, time-honored tradition of re-inventing the wheel, we offer here YET ANOTHER protocol that handles line-oriented data with interspersed binary text. This one trades away some of the performance optimizations of EventMachine::Protocols::LineAndTextProtocol in order to get better correctness with regard to binary text blocks that can switch back to line mode. It also permits the line-delimiter to change in midstream. This was originally written to support Stomp.
MaxLineLength | = | 16*1024 | TODO! We‘re not enforcing the limits on header lengths and text-lengths. When we get around to that, call receive_error if the user defined it, otherwise throw exceptions. | |
MaxBinaryLength | = | 32*1024*1024 |
Stub. Should be subclassed by user code. This is called when transitioning internally from text mode back to line mode. Useful when client code doesn‘t want to keep track of how much data it‘s received.
Alias for set_text_mode, added for back-compatibility with LineAndTextProtocol.
Called internally but also exposed to user code, for the case in which processing of binary data creates a need to transition back to line mode. We support an optional parameter to "throw back" some data, which might be an umprocessed chunk of the transmitted binary data, or something else entirely.
In case of a dropped connection, we‘ll send a partial buffer to user code when in sized text mode. User overrides of receive_binary_data need to be aware that they may get a short buffer.