Class EventMachine::Protocols::LineAndTextProtocol
In: lib/protocols/line_and_text.rb
Parent: Connection

A protocol that handles line-oriented data with interspersed binary text.

This version is optimized for performance. See EventMachine::Protocols::LineText2 for a version which is optimized for correctness with regard to binary text blocks that can switch back to line mode.

Methods

Constants

MaxLineLength = 16*1024
MaxBinaryLength = 32*1024*1024

Public Class methods

Public Instance methods

Set up to read the supplied number of binary bytes. This recycles all the data currently waiting in the line buffer, if any. If the limit is nil, then ALL subsequent data will be treated as binary data and passed to the upstream protocol handler as we receive it. If a limit is given, we‘ll hold the incoming binary data and not pass it upstream until we‘ve seen it all, or until there is an unbind (in which case we‘ll pass up a partial). Specifying nil for the limit (the default) means there is no limit. Specifiyng zero for the limit will cause an immediate transition back to line mode.

[Validate]