I am developing a WebSocket
server that will control multi client connections, it will basically work as a chat, it will be a kind of multiplayer game , after many searches and some tests I realized that when using Socket
for messages in asynchronous it is not possible to know if the message actually reached the client \ server and there is still the risk of the messages reaching the wrong order and this is crucial serial in a multiplayer game, after some research I saw that the solution to this was to implement a message queue for the socket, implementing the queue apparently is quiet theoretically would add all messages to the end of the queue and send the message from the first position and so respectively, but my doubt is how will I make sure the first message was sent to send the second in the queue and so on, if I have to implement a listener pair to this is a response from the server, besides having to inform which message is the response, this would influence the latency of my connection, which by the way has to be low, I am having difficulty solving this.
The server application is done in C#
I am using the framework Alchemy
Client applications are javascript using WebSockets
( HTML5
)