-1

I use SignalR on my Android app to exchange messages. Everything works fine, but I just do not know how to resend the message I sent when disconnected from the Internet when I connect to the Internet.

please help me

i I kept the messages in the list until after connect to internet they were sent back one by one, but this is a wrong way and it does not work.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
reyhane
  • 183
  • 1
  • 15

1 Answers1

0

You could store your messages in a database table. When a client is connected have messages delivered that are in the database. When the client has received through a function, have a response back to the HUB to do a function (mark the messages read or delete them from the table, etc...).

If a client gets disconnected, the messages are still in the table waiting to be delivered at next connection.

That is just an option. You need to determine what's best in your workflow.

Frank M
  • 1,379
  • 9
  • 18
  • This method is similar to keeping messages in the list, but my problem is with messing up messages after connecting to the Internet, which should be sent one by one with the order to send, but this does not happen. – reyhane Apr 29 '19 at 13:39
  • You can send based on "order" as a column in a table too or a timestamp for when the message to be sent was generated. If a client is disconnected and your messages are in a list, then you have other potential issue; as you described, cause of the disconnect, timing of reconnect, handling missed message, can you even get them back to send? – Frank M Apr 29 '19 at 14:44