Android Question webscocket and sending/receiving binary data

Modern_Digital

Member
Licensed User
Longtime User
Hi,

I have android app and i want to send custom type to the b4j server, I use B4XSerializator to convert the custom type to bytes and then i use the following websocket method :

B4X:
WebSocket1.SendBinary(data)

to send it to the b4j server and for receiving the binary data from the b4j server side i use the following event :

B4X:
Sub WebSocket1_BinaryMessage (Data() As Byte)
 Log("Binary message received.")
 'work with Data.
End Sub

the question here how can i receive the binary data in the b4j server side and how can i send back the binary data from the b4j sever to the android app.

Note: I want to mention that i use AddWebSocket method and WebSocket class in the b4j server.

Thank you.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Modern_Digital

Member
Licensed User
Longtime User
Thank you Erel, I know what you mentioned but I was wondering why there is a byte type parameter in the reception event if we send a text message from the server.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…