M Mostez Well-Known Member Licensed User Longtime User Aug 16, 2022 #1 I've implemented simple B4J Web Socket Server for ESP. Is it possible to serialize objects (user defined type) instead of string? I want to do something like Server: Code: Copy Type Info(ID As String, Name As String, MyArray() As Byte) Code: Copy Private ws As WebSocket ws.RunFunction("ScheckPointInf", Array As Object("E00",Info)) Client: Code: Copy Type Info(ID As String, Name As String, MyArray() As Byte) Code: Copy Sub WebSocket_NewMessage (FunctionName As String, Params() As Object) Select FunctionName Case "ScheckPointInf" Dim Inf as info = Parms(1) Log("Name: ", Inf.Name) End Select End Sub
I've implemented simple B4J Web Socket Server for ESP. Is it possible to serialize objects (user defined type) instead of string? I want to do something like Server: Code: Copy Type Info(ID As String, Name As String, MyArray() As Byte) Code: Copy Private ws As WebSocket ws.RunFunction("ScheckPointInf", Array As Object("E00",Info)) Client: Code: Copy Type Info(ID As String, Name As String, MyArray() As Byte) Code: Copy Sub WebSocket_NewMessage (FunctionName As String, Params() As Object) Select FunctionName Case "ScheckPointInf" Dim Inf as info = Parms(1) Log("Name: ", Inf.Name) End Select End Sub
DonManfred Expert Licensed User Longtime User Aug 16, 2022 #2 B4A - RandomAccessFile This works with B4A,B4J, probably B4i too. convertbytestoobject is used to get the type back from the serialized bytes. Don´t know it that works on the ESP.. don´t know it rRandomAccessfile is compatible too. Never worked with B4R. Upvote 0
B4A - RandomAccessFile This works with B4A,B4J, probably B4i too. convertbytestoobject is used to get the type back from the serialized bytes. Don´t know it that works on the ESP.. don´t know it rRandomAccessfile is compatible too. Never worked with B4R.
Erel B4X founder Staff member Licensed User Longtime User Aug 17, 2022 #3 B4XSerializator for B4A, B4i and B4J. B4RSerializator for B4A, B4i, B4J and B4R Upvote 0