-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String decoding problem #566
Comments
Hello @sonwh98, thx for your bug report! What was the handshake error? Greetings |
thanks for responding. I will report the handshake error in a different issue transit is UTF-8 encoded. I have no problem decoding it from the javascript side in a web browser. in the onMessage callback the hashCode of message:
new String(bytes.array(), "UTF-8");
|
Hello @sonwh98, well, it could be fine on for the browser since you don't compare the string on the hashCode level. So you are saying the hashCode changes after a hashCode() call? Thx for your input. That is right now not possible due to the 1.5 java version support (keeping the android support in mind) Greetings |
@marci4 I think I know whats going on, but I do not know if this is the proper behavior. encoding a vector in transit ["a"] produces a string which has 5 character and a hasCode of 85147669
in the onMessage the value of the message is the string which has 9 characters and a hasCode of -530250003. The characters in that string is:
it seems the string in the message has 2 extra |
@marci4 ok i think this is a problem with the serverside clojure websocket lib i'm using https://github.com/jarohen/chord I sent a raw clojure vector without encoding it with transit and got the expected string on the kotlin side. This shows that chord websocket library already does some kind of encoding before sending it to the client. It works on clojurescript in the browser only because i'm using the chord clientside lib that somehow knows how to decode. Sorry to bother you! the fix was to configure chord to format as string instead of EDN sonwh98/wocket@4384e89 |
I am using https://github.com/cognitect/transit-java to send json encoded messages between server and client.
On the server I'm using Clojure transit to encoded the list ["a" "b"] which gives the string
"[\"a\",\"b\"]"
with a hashCode of -939944225On the client in the WebSocketClient.onMessage I get a message=
"[\"a\",\"b\"]"
with a hashCode of -120497949. The string when printed to the console looks identical to whats encoded but it has a different hashCode which is making decoding transit message to fail.I created a custom built jar from master because using the jar from maven central failed with a handshake error
The text was updated successfully, but these errors were encountered: