COMMUNITY

How to convert Bytes to js.lib.ArrayBuffer or js.lib.ArrayBufferView

how to convert Bytes to js.lib.ArrayBuffer or js.lib.ArrayBufferView

current what I want send Bytes from websocket from js to server ,

websokcet .send

 @:overload( function( data : String ) : Void {} )
@:overload( function( data : Blob ) : Void {} )
@:overload( function( data : js.lib.ArrayBuffer ) : Void {} )
function send( data : js.lib.ArrayBufferView ) : Void;

You can use getData() on the bytes, on js this will return an ArrayBuffer (other targets will return a different type)

https://try.haxe.org/#86Ba5

thank you ,ibilon

I find a api call

Bytes.ofData