mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
29 lines
841 B
C#
29 lines
841 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.WebSockets;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace BTCPayServer
|
|
{
|
|
public class HwiWebSocketTransport : Hwi.Transports.ITransport
|
|
{
|
|
private readonly WebSocketHelper _webSocket;
|
|
|
|
public HwiWebSocketTransport(WebSocket webSocket)
|
|
{
|
|
_webSocket = new WebSocketHelper(webSocket);
|
|
}
|
|
public async Task<string> SendCommandAsync(string[] arguments, CancellationToken cancel)
|
|
{
|
|
JObject request = new JObject();
|
|
request.Add("params", new JArray(arguments));
|
|
await _webSocket.Send(request.ToString(), cancel);
|
|
return await _webSocket.NextMessageAsync(cancel);
|
|
}
|
|
}
|
|
}
|