public async Task Broadcast() { Transaction transaction = null; switch (this.Request.Content.Headers.ContentType.MediaType) { case "application/json": transaction = new Transaction(JsonConvert.DeserializeObject <string>(await Request.Content.ReadAsStringAsync())); break; case "application/octet-stream": { transaction = new Transaction(await Request.Content.ReadAsByteArrayAsync()); break; } default: throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } var tx = new BroadcastedTransaction(); tx.Transaction = transaction; await Configuration.GetBroadcastedTransactionsListenable() .CreatePublisher() .AddAsync(tx.ToEntity()); }
public async Task Broadcast([FromBody] string transaction) { var tx = new BroadcastedTransaction(); tx.Transaction = new Transaction(transaction); await Configuration.GetBroadcastedTransactionsListenable() .CreatePublisher() .AddAsync(tx.ToEntity()); }