Zaid-Ajaj / Fable.Remoting

Type-safe communication layer (RPC-style) for F# featuring Fable and .NET Apps
https://zaid-ajaj.github.io/Fable.Remoting/
MIT License
273 stars 55 forks source link

byte array does not work #96

Closed 0x53A closed 5 years ago

0x53A commented 6 years ago

My models look like this:

type Mesh = {
    Hash: byte array // 32 bytes

    Vertices: Vector3 array
    Indices: uint32 array

    Color: string
}

/// reference a mesh
type PlacedMeshRef = {
    Hash: byte array
    Placement : ObjectPlacement
}

when I send them from server to client I get an error:

grafik

Error: "Cannot convert ["JString","MYiahJg85WmXkHFtQHhmaEoy0JvgZGZmqnE9X0/jvMs="] to ["Array",null]"

grafik

It seems the issue is that the server encodes the byte array as base64, but the client expects an actual array.

Encoding it as base64 is probably a good idea to reduce data waste, so I guess the client should be updated to special case byte arrays.

Zaid-Ajaj commented 6 years ago

I didn't know the server does that haha, no problem I will try to fix this one today, of course, if you want to give it a try too then be my guest :smile: PR's are always welcome

0x53A commented 6 years ago

I'll try to send something tomorrow.

Looks like uint is also not supported:

grafik


type Mesh = {
    Hash: string //byte array // 32 bytes

    Vertices: V3 array
    Indices: uint32 array // <--- I guess it fails here

    Color: string
}

No uint

grafik

Zaid-Ajaj commented 5 years ago

Fixed in SimpleJson/PR-18, will patch remoting client as soon the nuget is ready

Zaid-Ajaj commented 5 years ago

Fix and published in version 4.5.3 of the remoting client, can you please update and check whether the issue persists?

I will open a separate issue for unsigned integers

0x53A commented 5 years ago

Looks good.

Thank you!