Angular deserialization of ushort array sent with signalR messagepack

Discussão em 'Angular' iniciado por Neran, Março 20, 2025.

  1. Neran

    Neran Guest

    I have an asp.net server that sends data as ushort[] to clients via signalR messagepack. When listening for that data on my angular client using this code:

    this.hub.addListener('SendImage', (data: Uint16Array ) => {
    console.log(data instanceof Uint16Array);
    ...
    }

    // and the signalr builder
    this.hubConnection = new HubConnectionBuilder()
    .withUrl(`${this.configService.apiBaseUrl}/signalRHub`)
    .withAutomaticReconnect([0, 1000, 10000, 30000])
    .withHubProtocol(new MessagePackHubProtocol())
    .build();


    it seems like the data is not deserialized as Uint16Array. The console logs false. If the server sends the data as byte[] instead and my client side receives the data as Uint8Array then its fine. Im using the default Add

    Is it possible to directly receive the data as Uint16Array?

    Continue reading...

Compartilhe esta Página