How about moving line 8 inside the loop. That way each web socket will connect individually.
The way you have it now, you will only get one WS_CONNECTED for one of the sockets, no guarentee which one.
Alternatively, you could move the WS_CONNECTED to its own sub.
Thanks Andrew, you are completely right. That shows me when a websocket is connected - so far so good. But how do I know which one is connecting, and do I need to make a separate Sub to find out?
And also, how would I apply the below afterwards so it covers all the arrays? I mean, I get the content from all of them and luckily I don´t need to know for which one the message is received. But the Do While part cannot be used here, since I will have to address the specific websocket in the array, which makes no sense to do, since I want to know if any of the sockets gets disconnected but still keep the connection for the others.
Do While ws.Connected
Wait For ws_Textmessage (Message As String)
Loop
I guess it´s a matter of having a Sub WS_Connected here, as you suggested, and then just make an endless loop (Do while 1 = 1 for instance) instead of the above, where the messages are received through the sockets. But how do I know in Sub Ws_Connected which websocket that gets disconnected?
Sorry, but I´m a noob when it comes to setting stuff like this up as an array.