Page 1 of 1

ArrayBuffer support

Posted: 08 Oct 2018, 13:50
by Rob
Is regular js Arrays the only accepted type to interact with SFSDataType.BYTE_ARRAY in SFSArrays/SFSObjects?

If so, I'd like to suggest you add ArrayBuffer (or at least a typed array) as a valid type as well in order to avoid unnecessary data conversions when the original data is already in ArrayBuffer format.

Re: ArrayBuffer support

Posted: 09 Oct 2018, 09:56
by Lapo
Hello,
yes I think you're right. The current version of the API is representing byte arrays as number arrays which is unoptimized.
Instead we could improve both putByteArray() and getByteArray() using the Uint8Array JS type, to keep memory usage in check and restrict types to actual bytes.

Makes sense?
Thanks

Re: ArrayBuffer support

Posted: 09 Oct 2018, 10:51
by Rob
Yes that sounds like a good improvement.

Re: ArrayBuffer support

Posted: 09 Oct 2018, 15:48
by Lapo
Okay, we'll prepare a new release during the week.

Re: ArrayBuffer support

Posted: 10 Oct 2018, 08:41
by Lapo
UPDATE:
we've released the update for the Javascript API.
https://forums.smartfoxserver.com/viewt ... 33&t=20902

Cheers