async.base_protocol module

class pyrlang.async_support.base_protocol.BaseProtocol(*_args, **_kwargs)

Bases: object

Defines abstract protocol handler class. Adapters from Gevent, Asyncio etc are created in corresponding modules and are plugged in when engine is selected.

close_requested_ = None

Set this to True and the connection will be closed soon.

destroy()

Stop due to an external demand.

on_connected(host_port: tuple)
on_connection_lost()
on_incoming_data(data: bytes) → Optional[bytes]

Attempt to consume first part of data as a packet

Parameters:data -- The accumulated data from the socket which we try to partially or fully consume
Returns:Unconsumed data, incomplete following packet maybe or nothing. Returning None requests to close the connection
periodic_check()

Override this to do periodic checks on something.

send(msg: bytes)
send_buffer_ = None

Collects outgoing data.