Scarlet icon indicating copy to clipboard operation
Scarlet copied to clipboard

Are @Send methods blocking and can they return a confirmation whether a send action was successful?

Open gajicm93 opened this issue 4 years ago • 6 comments

I tried looking through documentation but can't find any clear answer.

I need to know whether @Send methods are blocking, and is there any way to get a confirmation if send action was successful, so I can potentially implement a backup API call in case socket fails..

Thanks.

gajicm93 avatar Feb 04 '21 12:02 gajicm93

I don't think that this can be implemented in sockets functionality. Socket is just a pipe that you either throw stuff in or get stuff from it. There is not a callback for each send. I guess you have to implement some request/response actions in your API.

This is what I know. But I would like to hear if anybody knows more about it!

james04gr avatar Feb 04 '21 12:02 james04gr

It could at least return false if connection is disconnected/destroyed

jemshit avatar Jul 25 '21 11:07 jemshit

No...thats not the way Sockets work. Socket is just an open bi-directional "road" between two end points and they can send data packets one to another. The only way to know the status of the connection is the PingPong method.

james04gr avatar Jul 25 '21 11:07 james04gr

@james04gr i did not claim otherwise. It can return false in disconnected/destroyed case because Scarlet has connection state internally

jemshit avatar Jul 25 '21 12:07 jemshit

@james04gr i did not claim otherwise. It can return false in disconnected/destroyed case because Scarlet has connection state internally

Oh ok....i thought u spoke generally!

james04gr avatar Jul 25 '21 12:07 james04gr

@james04gr i did not claim otherwise. It can return false in disconnected/destroyed case because Scarlet has connection state internally

I think that's already the case, just make the @send function return a boolean and you'll get false if the connection is disconnected.

anasmadrhar avatar Dec 27 '21 04:12 anasmadrhar