A TypeScript HubSockets npm package to be used with the C# server-side HubSockets nuget package.
Repo: https://github.com/sladewasinger/HubSockets-Client
https://github.com/sladewasinger/HubSockets
import { HubSocketService } from 'hubsockets-client';
hubSocketService = new HubSocketService();
await hubSocketService.doConnect(
'wss://' + window.location.hostname + ':443/ws'
);
hubSocketService
.listenOn<GameState>('GameStateUpdated')
.subscribe((x) => this.gameStateUpdated(x));
const hubResponse = await this.hubSocketService
.sendWithPromise<HubResponse<number>>('GetTotalPlayerCount', {});
const count = hubResponse.data;
hubSocketService.send('Clear', '');