Dear All,
In this app, in case the network is unreachable and/or the phone is being turned off, I´m building a list of messages pending to be sent to the server whenever there´s a connection. The list is removed as soon as the messages are succesfully sent, which is triggered via a timer event which checks every 5 seconds if there´s anything in the list, and attempts to send the items.
This works well, except for one thing:
Each unsuccesful attempt to send the messages is added to a buffer that gets released once there´s a connection. So if I wait 3x5 = 15 seconds with the connection turned off, then when turning it on again I have the 3 post jobs firing off together with the 1st succesful post event taking place - 4 in total.
So I´d like to find a way to remove these pending events, which obviously are there for a good reason so that indeed offline messages automatically will fire when the connection becomes available. I do want to have control over this though, so that they´ll also fire when the device is turned off while offline, and on again, and this is where b4as own "protection" conflicts with what I´m doing.
I´ve already checked if it´s windows buffering the messages, but JobDone is triggered every time a buffered message is sent, so it has to be in b4a that this is happening.
Is there some flush command I could use for this? Been looking for it, but not able to find it.
Only workaround I can think of is if there´s an event like Jobdone which handles the outgoing data before it´s actually sent to the socket, where I could stop these "ghost" events from the buffer.
Help appreciated, thanks!
In this app, in case the network is unreachable and/or the phone is being turned off, I´m building a list of messages pending to be sent to the server whenever there´s a connection. The list is removed as soon as the messages are succesfully sent, which is triggered via a timer event which checks every 5 seconds if there´s anything in the list, and attempts to send the items.
This works well, except for one thing:
Each unsuccesful attempt to send the messages is added to a buffer that gets released once there´s a connection. So if I wait 3x5 = 15 seconds with the connection turned off, then when turning it on again I have the 3 post jobs firing off together with the 1st succesful post event taking place - 4 in total.
So I´d like to find a way to remove these pending events, which obviously are there for a good reason so that indeed offline messages automatically will fire when the connection becomes available. I do want to have control over this though, so that they´ll also fire when the device is turned off while offline, and on again, and this is where b4as own "protection" conflicts with what I´m doing.
I´ve already checked if it´s windows buffering the messages, but JobDone is triggered every time a buffered message is sent, so it has to be in b4a that this is happening.
Is there some flush command I could use for this? Been looking for it, but not able to find it.
Only workaround I can think of is if there´s an event like Jobdone which handles the outgoing data before it´s actually sent to the socket, where I could stop these "ghost" events from the buffer.
Help appreciated, thanks!