B4J Question [JServer | Websocket Server] send multiple data through frames

Waldemar Lima

Well-Known Member
Licensed User
Hello everyone,
is it safe and reliable for me to send multiple server information to the client this way?

Client :

B4X:
' Sending Request from Client to WebSocket Server
    Dim data As Map
    data.Initialize
    data.Put("username", "")
    wsh2.SendEventToServer("Device_Teste",data)
    data.Clear

' Sub to receive Msg from Websocket Server
Sub wsh_Server_Teste(Params As List)

    Log("Ingressado Autenticado !")
    Dim Answer As String = Params.Get(0)
   
    Log(Answer)
   
End Sub


Server Websocket Sub :

B4X:
'Sub to Send data to Client 
Sub Device_Teste(Params As Map)
    Log("Teste Call")
  
    For i = 1 To 500
        ws.RunFunction("Server_Teste", Array As Object(i))
        ws.Flush
    Next
  
End Sub
 

Waldemar Lima

Well-Known Member
Licensed User

my fear is that the information that would be sent frame by frame to the client would exceed 65565 bytes of packet size. So from my point of view, sending one by one would not have memory overflow, right?
 
Upvote 0

lucasheer

Active Member
Licensed User
Longtime User
my fear is that the information that would be sent frame by frame to the client would exceed 65565 bytes of packet size. So from my point of view, sending one by one would not have memory overflow, right?

I don't think there is a limit to the packet size, but you can send a bitmap or a generated array to test this.

You should be good
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…