V Victor jung Member Licensed User Longtime User Mar 14, 2017 #1 Hello, I am trying to play with the jmqtt library. But I have trouble going from bytes to string and reverse for the payload... Stringtobytes https://www.b4x.com/android/help/byteconverter.html seems a great method for this but it seem's to have disappeared, or at least i can't figure how to use it... I tried using serializator: Code: Sub Button1_Click client.Publish2("hello", serializator.ConvertObjectToBytes("CLIC"), 0, False) End Sub my issue is that it's not received by any b4x code, so I don't know how to read the "crap" sent with this method. Any ideas or input are welcomed. Thank you verry much. Victor
Hello, I am trying to play with the jmqtt library. But I have trouble going from bytes to string and reverse for the payload... Stringtobytes https://www.b4x.com/android/help/byteconverter.html seems a great method for this but it seem's to have disappeared, or at least i can't figure how to use it... I tried using serializator: Code: Sub Button1_Click client.Publish2("hello", serializator.ConvertObjectToBytes("CLIC"), 0, False) End Sub my issue is that it's not received by any b4x code, so I don't know how to read the "crap" sent with this method. Any ideas or input are welcomed. Thank you verry much. Victor
Erel B4X founder Staff member Licensed User Longtime User Mar 14, 2017 #2 B4XSerializator is only relevant if both sides use it. Code: client.Publish2("hello", "CLIC".GetBytes("utf8"), 0, False) Use BytesToString keyword to convert an array of bytes to string. Upvote 0
B4XSerializator is only relevant if both sides use it. Code: client.Publish2("hello", "CLIC".GetBytes("utf8"), 0, False) Use BytesToString keyword to convert an array of bytes to string.
V Victor jung Member Licensed User Longtime User Mar 14, 2017 #3 Hello erel, Thanks for the quick reply, is there another quick trick to do this the other way around? bytes to string? Victor oops, sorry I didn't read it properly! Upvote 0
Hello erel, Thanks for the quick reply, is there another quick trick to do this the other way around? bytes to string? Victor oops, sorry I didn't read it properly!