-
Notifications
You must be signed in to change notification settings - Fork 1.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
Float32Array from Javascript // JacksonJsonSupport.DeserializationFeature #201
Comments
You may do it like this:
|
Yes. Check BinaryEventLauncher in netty-socketio-demo project |
@JesusOfSuburbia try this, maybe it will help you function arrayBufferToBase64 (buffer) {
var binary = '';
var bytes = new Uint8Array(buffer);
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
}
var myData = new Float32Array([0.0, 1.1, 2.2, 3.3]).buffer;
socket.emit('msg', arrayBufferToBase64(myData)); although, this is unlikely to help you :) |
@tselishev-semen @mrniko like {
data : new Float32Array().buffer,
id : "somestring"
} And thanks for the JacksonJsonSupport example provided above, currently trying to do this! 👍 |
Hi guys,
nice work you did here. Thank you so much!!
Anyway, I stumbled upon a problem and really need some help.
I'm currently trying to pass a Float32Array from Javascript to Java.
The following error occurs:
I searched for the code where the exception happens, and you can find the following there:
I think I have to enable this
DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY
.The Float32Array seems to be interpreted as a "single value" by the deserializer.
You can get the JacksonJsonSupport from
com.corundumstudio.socketio.Configuration
,but there is no chance to change the Features there, they are hardcoded in the
init()
:... and also private.
Any idea or help on this? Do I need to fork? Is the problem somewhere else, maybe in my JavaScript?
The strange thing is, with
Uint8Array
(JavaScript) tobyte[]
(Java) it works without a problem.So here is the code I use in Javascript:
Finally:
Does netty-socketio support binary within complex objects?
It does not work with custom object in
addEventListener
, set function fails withConflicting setter definitions for property
This is the syntax as supported by socket.io:
The text was updated successfully, but these errors were encountered: