B4J Question [websocket] Error receive message from javascript

Roberto P.

Well-Known Member
Licensed User
Longtime User
Hi everyone
I created a simple example of a websocket with b4j which should exchange data with a simple html page.

I can't intercept the function (name and structure) that I get from the client.
Can anyone tell me how I can solve the problem.

WebSocket:
'WebSocket class
Sub Class_Globals
    Private ws As WebSocket
End Sub

Public Sub Initialize
    
End Sub

Private Sub WebSocket_Connected (WebSocket1 As WebSocket)
    ws = WebSocket1
    
    ws.Alert("connesso..")
    
    Dim aList As List
    aList.Initialize
    
    aList.Add("ciao siamo connessi")
    
    ws.RunFunction("ResposeData", aList)
    ws.Flush
    
    
End Sub

Private Sub WebSocket_Disconnected

End Sub


Public Sub WebSocket_Message(pMessage As List)
    Log(pMessage)
End Sub

JavaScript:
    window.onload = function(){
        log(log.buffer.join("\n"));

        document.getElementById("sendButton").onclick = function(){
            w.send(document.getElementById("inputMessage").value);
        }
    }



thank in advance
regards
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…