B4J Question jWebSocketClient ... in a jServer

pierrem

Member
Licensed User
Longtime User
Hi,

from then examples provided in this forum.

I have 2 servers named Master & Slave

In Master I have
B4X:
Sub Timer1_Tick
    ws.RunFunction("ServerTime", Array As Object(DateTime.Time(DateTime.Now)))
    ws.Flush
End Sub

in Slave, I have
B4X:
Sub AppStart (Args() As String)
    srvr.Initialize("")
    srvr.Port = 51042
    srvr.AddWebSocket("/ws", "B4A")
    srvr.Start
   
    ' ################################
    ' rem : wsc is declared in Process_Globals as webSocketClient

    wsc.Initialize("wsc")
    wsc.Connect("ws://XXXXXX.duckdns.org:51042/ws")
    ' ################################
   
    StartMessageLoop
End Sub

Sub wsc_ServerTime(p As List)
    Log("Received from Master :"&p.Get(0))
End Sub

Master in running and ticking it's time, I have verified this from an android app.
(the servers are running on differents machines, no port problem)

I expect the Slave console to display "Received from Master : xx:xx:xx",
but the Slave wsc_ServerTime seems to not be called/executed.

Where is my mistake ?

Thks in advance
 

pierrem

Member
Licensed User
Longtime User
Are you handling the Connected event? Is it raised?

It was not correctly !
spelling mistake ...

Thks for your help
:)
 
Upvote 0
Top