SuperWebSocket icon indicating copy to clipboard operation
SuperWebSocket copied to clipboard

Conflict NewMessageReceived event

Open tondar20 opened this issue 6 years ago • 0 comments

After multiple clients send different messages at the same time, all events fire, but all messages are the same as the last client's message that arrived. It appears as if the last client's message creates a conflict and destroys the previous messages.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim MyWebSocket As WebSocketServer = New WebSocketServer()
    MyWebSocket.Setup(prot)
    MyWebSocket.Start()

    AddHandler MyWebSocket.NewMessageReceived, AddressOf MyWebSocket_NewMessageReceived
End Sub

event:

Private Sub MyWebSocket_NewMessageReceived(session As WebSocketSession, value As String)
    Invoke(Sub()
               ListBox1.Items.Add(value)
           End Sub)
End Sub

If two clients send a message at the same time, for example: Client1.Send("Data1") Client2.Send("Data2") then ListBox1.Items are Data2, Data2.

What's the solution?

tondar20 avatar May 08 '19 08:05 tondar20