I am writing a Web application for copying files between servers.
I decided to write a WebSocket server which will receive and send relevant messages (that is communicate with a browser), start and stop copying processes.
Accordingly my design decision, there is at most one copying process for a given user. A user does not "see" copying processes of other users. But one user may open multiple browser windows and thus have multiple connections to my WebSocket server.
When a copying process starts, the relevant user receives { "type": "Started" }
JSON message. This may be a reply to the request to start copying files either from the current window or an other window of the same user.
When receiving { "type": "Started" }
message, the JavaScript should show dialog "Copying files..." with "Interrupt" button (to interrupt copying in the middle). The dialog automatically closes if copying finishes (with or without an error).
Also if the copying cannot start for some reason, the browser receives a { "type" : "Error" }
message.
Now my question: Should the server immediately reply with some message (maybe { "type": "StartReply" }
) after copying starts? Or is it enough that we anyway will receive { "type": "Started" }
message in near future?
Also: Should I number "Start" messages and include its number in a "StartReply" message, to know which message is answer on which one?