B4J Question Send message from server to client using websocket.

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Websocket not websocketclient.

The only way to send a message to the client is by using:

B4X:
RunFunction (Function As String, Args As List)?
?

Is there a method of just sending a message?

Something like?

B4X:
ws.send("Hello World")

Maybe I did not see it any other way.
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
You must use WebSocketHandler on the clients. Sending messages is done with RunFunction and it is very simple to use: https://www.b4x.com/android/forum/threads/websocket-client-library.40221/#content

For clients made in b4a or b4j I have already done this.

In this specific case I am creating a b4j server. Clientes will be games created with construct2.

Function name would be unnecessary.

I believe that having more a simple method like
B4X:
ws.send (str)
would open the door to more different types of clients.
 
Upvote 0
Top