GCM XMPP delivery receipt send other machine and G

2019-08-12 02:14发布

问题:

I have an application running on two machines, each of them are have established a connection through GCM via TCP(XMPP).

One issue i'm experiencing is that sending an xmpp message through one connection with the 'delivery_receipt_requested' flag, does not necessarily means receiving the receipt for that message on the same connection. This is obviously very problematic, since connections might be set up on different processes, sometimes on different machines.

An other issue is that machine received delivery_receipt (which does not send original message) tries to send a delivery receipt ack to the GCM, GCM closes this connection.

Does it seem to be weird? GCM send delivery receipt an other machines and when it receives the delivery receipt ack from that machine it closes the connection since message does not send from that machine?

回答1:

I have found the reason why connection is closed. I had many connection and my application sent deliverty_receipt_ack to the GCM over any connection in connection pool. And after some period of time google sent XMPP error with "received more ack than expected" then connection was closed.

This communication model causes the connection-closed problem, correct way is to use the connection received deliverty_receipt in order to send delivery_receipt_ack, in other word using same connection to send delivery_receipt_ack in reponse to delivery_receipt solves the problem.



回答2:

is it a must to send an ack for delivery receipt? i haven't any issues so far without sending it, well except for the huge delay when the phones have lousy connections, e.g. from a foreign country.