We've recently started using the heartbeat connection option, and I need to understand them precisely. I understand that both client and server side can send heartbeat frames, that other activity can substitute for a heartbeat frame, and that the intervals are negotiated during tuning.<br>
<br>What's confusing me is this: Some threads such at this one imply that the server "periodically sends heartbeat frames to the client and waits for its response."<br><a href="http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-August/014491.html">http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-August/014491.html</a><br>
<br>What exactly is the proper response from the client? I've searched for hours looking for the format of the response and not found it.<br><br>Confounding matters, at least three client libraries I've looked at (including Pika and .NET) explicitly check for heartbeat frame (i.e., 8) and then do nothing with them. For instance in the Pika _on_data_available method():<br>
<br> <span style="font-family:courier new,monospace"> while self._frame_buffer:</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> # Try and build a frame</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> consumed_count, frame = pika.frame.decode_frame(self._frame_buffer)</span><br style="font-family:courier new,monospace"> <br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> ...</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> # We don't check for heartbeat frames because we can not count</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> # atomic frames reliably due to different message behaviors</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> # such as large content frames being transferred slowly</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> elif isinstance(frame, pika.frame.Heartbeat):</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> continue</span><br>
<br><br>Is this correct behavior or am I simply not understanding how the heartbeat mechanism is supposed to work.<br><br><br>