Hello guys, I'm trying to create 1000 websocket connections, but something isn't working...
What am I doing wrong?
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
'Log("Hello world!!!")
For i = 1 To 1000
Dim wsh As WebSocketHandler
wsh.Initialize(Me,"wsh")
wsh.Connect("ws://127.0.0.1:80/mygame")
Wait For wsh_Connected
Log("connected "&i)
Dim tmp As Map
tmp.Initialize
tmp.Put("RoomType", "1")
tmp.Put("RoomSizeMax", "4")
wsh.SendEventToServer("Device_FindMatch",tmp)
'Sleep(1)
Next
StartMessageLoop
End Sub
Sub wsh_room_matchfound(params As List)
Log("room found : ")
Log(params)
End Sub
Sub wsh_Closed(reason As String)
Log("disconnected.: "&reason)
End Sub
What am I doing wrong?