Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
WICED AMQPv0.9 has heartbeat feature but there is no sample application to demonstrate the feature. The AMQPv1.0 spec has no information about heartbeat feature. User have to send empty packets to keep the connection alive.
I tried to set up a heartbeat or a regular ping to keep the connection active according to the request of the OASIS documentation (OASIS Advanced Message Queuing Protocol (AMQP) Version 1.0)
« The use of idle timeouts is in addition to any network protocol level control. Implementations SHOULD make use of TCP keep-alive wherever possible in order to be good citizens. If a peer needs to satisfy the need to send traffic to prevent idle timeout, and has nothing to send, it MAY send an empty frame, i.e., a frame consisting solely of a frame header, with no frame body. Implementations MUST be prepared to handle empty frames arriving on any valid channel, though implementations SHOULD use channel 0 when sending empty frames, and MUST use channel 0 if a maximum channel number has not yet been negotiated (i.e., before an open frame has been received). Apart from this use, empty frames have no meaning. »
Finally to keep the connection alive, we tested the following things in vain : 1. Send a header frame (every 30sec) with amqp_manager() function and the parameter :WICED_AMQP_EVENT_SASL_HDR_SENT. 2. Send a « flow » frame (every 30sec) with fwiced_amqp_update_link_credit() function, device avoid idle time out after 4 min but could be disable after 1-2 hours. 3. Send a keep alive according to the test snip/keep_alive and a ping with wiced_ping() function on amqp socket.
Main problem is if I use AMQP libraries to send empty packets to keep the connection alive,it is not free !
The spec says that we need to send an empty packet to maintain the AMQP connection and as per your comments, I believe you are sending one. I just need few more details about the packet:
1. Why is a SASL_HDR sent? It should be a transfer packet with data length=0.
2. What is the maximum time the device for which the client is not sending data to the server? Azure have an idle timeout of 10 minutes and if no transfer takes place within this time, the connection will be closed.
3. What is the channel number on which you are sending the packet? Empty packets should be on channel 0
4. What happens when you try to send the data after the connection is lost? Do you receive any CONNECTION_ERROR event? If the connection (i.e.,the TCP connection is lost) the callback function "amqp_network_disconnect_callback" should be called. The queued error is then taken care in "amqp_network_queue_thread".
Can you check if these functions are called when link is broken?