ilan Expert Licensed User Longtime User Aug 8, 2021 #1 hi how can we use websocket EvalWithResult function with promises? thanx, ilan
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2021 #2 It should be done in the JavaScript itself. You might need to call b4j_raiseEvent to raise a server event from the "then" function. Upvote 0
It should be done in the JavaScript itself. You might need to call b4j_raiseEvent to raise a server event from the "then" function.
ilan Expert Licensed User Longtime User Aug 8, 2021 #3 Erel said: It should be done in the JavaScript itself. You might need to call b4j_raiseEvent to raise a server event from the "then" function. Click to expand... ok thanks i will try Upvote 0
Erel said: It should be done in the JavaScript itself. You might need to call b4j_raiseEvent to raise a server event from the "then" function. Click to expand... ok thanks i will try
ilan Expert Licensed User Longtime User Aug 8, 2021 #4 Erel said: It should be done in the JavaScript itself. You might need to call b4j_raiseEvent to raise a server event from the "then" function. Click to expand... it was simpler than i thought ? js code: B4X: ws.Eval($"getIPs().then(res => {b4j_raiseEvent("get_public_ip",{res});});"$,Null) b4j event: B4X: Sub get_public_ip(Params As Map) If Params.ContainsKey("res") Then Dim l As List = Params.Get("res") For i = 0 To l.Size-1 Log(l.Get(i)) Next End If End Sub public ip cdn: B4X: <script src="https://cdn.jsdelivr.net/gh/joeymalvinni/webrtc-ip/dist/bundle.dev.js"></script> thanx ? Last edited: Aug 8, 2021 Upvote 0
Erel said: It should be done in the JavaScript itself. You might need to call b4j_raiseEvent to raise a server event from the "then" function. Click to expand... it was simpler than i thought ? js code: B4X: ws.Eval($"getIPs().then(res => {b4j_raiseEvent("get_public_ip",{res});});"$,Null) b4j event: B4X: Sub get_public_ip(Params As Map) If Params.ContainsKey("res") Then Dim l As List = Params.Get("res") For i = 0 To l.Size-1 Log(l.Get(i)) Next End If End Sub public ip cdn: B4X: <script src="https://cdn.jsdelivr.net/gh/joeymalvinni/webrtc-ip/dist/bundle.dev.js"></script> thanx ?
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2021 #5 You can make is simpler: B4X: ws.Eval(...) Wait For get_public_ip(Params As Map) Log(Params) Upvote 0