2

I am building a comet service which will push new data to the client on mobile devices. For this, I am using websockets to deliver messages to the client.

The problem I am facing here is the reliable delivery of a message to the client. How can I be sure that the data I sent over the websocket was actually received by the client?

Proposed solutions:

  • Sending a custom ack from the client and block other messages till then.
  • Sending a hint to the client about the new data and let it fetch the data by itself.
1
  • At a low level, TCP sends ACK packets during transmission. How can building your own ACK responses guarantee that the client received the data, but the ACK didn't die en route back to the client? Not even TCP can mitigate this problem. Commented Jan 16, 2022 at 18:21

1 Answer 1

1

This may be kind of a duplicate question.


Short answer: It depends on your implementation and tools you are using.


Websockets are built on top of TCP so there is no data/packet loss if connection exists, however if there is no connection, then obviously the message will not be recieved.

Check this out for more information

If your message cannot be delivered, the websocket will throw an error. You can handle it however you like.

For example, in my application when a push fails for a message, I can try sending it again at a later point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.