View Source mqtt_sessions_process (mqtt_sessions v2.8.0)
Process handling one single MQTT session. MQTT connections attach and detach from this session. Buffers outgoing messages if there is no connection attached. For every session we also start a mqtt_sessions_will process which will trigger a session kill if the session is disconnected too long, or if the session crashes. If the session is killed then the optional will message is published by the will process. If a client is disconnected then messages are buffered. The buffering behaviour depends on the QoS of the message. QoS 0 messages are only buffered if the connection was down for a very short period. QoS 1 and 2 messages are buffered for a period of time. This period is either the message_expiry_interval or the default buffered message expiry. There is also a maximum number of messages buffered. Past the maximum the buffer will start shedding messages. This is separate for QoS 0 and QoS 1/2 messages.
Summary
Functions
-spec get_transport(pid()) -> {ok, mqtt_sessions:transport()} | {error, notransport | noproc}.
-spec incoming_connect(pid(), mqtt_packet_map:mqtt_packet(), mqtt_sessions:msg_options()) -> ok.
-spec incoming_data(pid(), binary()) -> ok | {error, wrong_connection | packet_too_large | mqtt_packet_map:decode_error()}.
-spec kill(pid()) -> ok.
-spec start_link(Pool :: atom(), ClientId :: binary(), mqtt_sessions:session_options()) -> {ok, pid()}.