class Analogger::Protocol

Defined in:

analogger/protocol.cr

Constant Summary

MAX_MESSAGE_LENGTH = 8192
REGEXP_COLON = /:/

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : TCPSocket, logger : Analogger::Core) #

[View source]

Instance Method Detail

def handle(data) #

This is the key method for receiving messages and handling the protocol. The current protocol is a very simple wire protocol. A packet of data contains an 8 byte header that encodes, in ASCII, the number of characters that are in the message as a pair of 4 digit numbers. The repeated length represents a trivial checksum on the received packet.


[View source]
def receive #

[View source]
def send_data(data, flush_after_send = false) #

[View source]