hilla
hilla copied to clipboard
JS Typed Arrays (like Uint8Array) should be supported
When transferring primitive array-like data using Connect endpoints, I want primitive Java arrays like byte[] to be mapped to typed JS arrays like Int8Array, so that (a) the transfer is more efficient in terms of how many bytes are sent over the wire and (b) I do not have to write the boilerplate code to convert from a typed array into an regular JS array of numbers.
Example:
@VaadinService
public class DataService {
public void foo(byte[] data) {
}
}
export function foo(
data: Int8Array
): Promise<void>
The first solution could be based on base64 encoding, later it can be improved to multi-part requests.
Would be good to add support for Int8Array/byte[] to @ClientCallable as well.
@ClientCallable is a completely separate thing from the implementation point of view. Could you please create a separate ticket about that?