最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

angular - Deserialization of ushort array sent with signalR messagepack - Stack Overflow

programmeradmin2浏览0评论

I have an asp 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?

发布评论

评论列表(0)

  1. 暂无评论