示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }