private async Task SendAsync(ClientWebSocket client, CancellationToken cancelToken, PubsubPayload payload) { var writer = Serializer.Write(payload); await client.SendAsync(writer.AsSegment(), WebSocketMessageType.Text, true, cancelToken); SentPayload?.Invoke(payload); }
private async Task SendAsync(ClientWebSocket client, CancellationToken cancelToken, GatewayPayload payload) { var writer = EtfSerializer.Write(payload); await client.SendAsync(writer.AsSegment(), WebSocketMessageType.Binary, true, cancelToken); SentPayload?.Invoke(payload, new PayloadInfo(writer.Length, writer.Length)); }
private async Task SendAsync(ClientWebSocket client, CancellationToken cancelToken, RpcPayload payload) { payload.Nonce = Guid.NewGuid(); var writer = JsonSerializer.Write(payload); await client.SendAsync(writer.AsSegment(), WebSocketMessageType.Text, true, cancelToken); SentPayload?.Invoke(payload, new PayloadInfo(writer.Length, writer.Length)); }