Skip to content
This repository has been archived by the owner on Oct 19, 2019. It is now read-only.

Conflict NewMessageReceived event #51

Open
tondar20 opened this issue May 8, 2019 · 0 comments
Open

Conflict NewMessageReceived event #51

tondar20 opened this issue May 8, 2019 · 0 comments

Comments

@tondar20
Copy link

tondar20 commented May 8, 2019

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant