Hi,
I've been seeing same operation being sent twice in my app using ShareJS, and it seems to happen when the client disconnects and doesn't get the ack back and resends the same op on reconnect. I was about to get my hands dirty writing a hack to reject double ops, but stumbled upon `dupIfSource` which seems to be a more elegant approach.
The problem is I'm not sure what to send as value for this property. The comment says :
# Dup detection works by sending the id(s) the op has been submitted with previously.
# If the id matches, we reject it. The client can also detect the op has been submitted
# already if it sees its own previous id in the ops it sees when it does catchup.
But then it compares the source of the op with the dupIfSource array, so I'm not sure what the 'id' of an op means :
if oldOp.meta.source and opData.dupIfSource and oldOp.meta.source in opData.dupIfSource
The meta.source is the sessionId for the connection.
The way I see it, I should keep a history of sessionIds on the client (I get a new one after a reconnect) and send that array as value for the dupIfSource parameter.
I know this is probably obscure code, but if anyone stumbled on this or remembers it, I'd appreciate it :)
Thanks,
Adrian