Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
Dim wsc As WebSocketClient
Dim st As WiFiServerSocket
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
If wifi.Connect2("******", "*******") Then
Log("Connected to network")
Else
Log("Failed to connect to network")
End If
wsc.Initialize("incoming","loggedOff")
Log("after init")
connect(0)
Log("after host connect")
Dim datamap() As String = Array As String("key1","data1")
Log("after datamap")
wsc.SendEventToServer("hello_there",Array As String("key1","value1"))
Log("after send to server")
End Sub
Sub connect(unused As Byte)
If wsc.ConnectHost(st.Socket.Stream,"192.168.0.12" , 51042, "/test") Then
Log("Connected...")
Else
Log("Connection failed")
CallSubPlus("Connect", 1000, 0)
End If
End Sub
public Sub incoming (FunctionName As String, Params() As String)
Log(FunctionName)
Log(Params(0))
End Sub
public Sub loggedOff
Log("disconnected")
End Sub