Market at 1/2/2023, 6:34:12 PM

BITCOIN
+
BTC
0
LITECOIN
+
LTC
0
DOGE
+
DOGE
0
ETHEREUM
+
ETH
0
BCASH
+
BCH
0
DASH
+
DASH
0
USD/EUR
+
EUR
0
USD/GBP
+
GBP
0
USD/BRL
+
BRL
0
  • APESHIFT ENVOY

Market Indices are the same for everyone so, in this scenario, we can serve all clients with a single task.

WEB APP
async Task<string> GetToken()
{
 var envoytask = new Ape.EnvoyTask()
 {
  task_context = "marketrates",
  send_offline_message = true,single_instance = false,
  timeout = 5,persist_timeout = false
 };
 var client = new Ape.GetEnvoyTokenRequest()
 {
  reusable_minutes = 2,envoy_task = envoytask
 };
 var aperesp = await POST.Request(Ape.api_methods.get_envoy_token, client);
 var tokenResp = JsonDeserialize(aperesp).Result;
 return tokenResp.envoy_token;
}

With the following method the remote process performs a single HTTP request to serve all active clients.

SERVICE
async Task GetRatesTask()
{
 while (true)
 {
  var rates = await Pricer.GetCoinbase();
  var req = new InvokeEnvoyRequest
  {
   new_timeout = 5, message = rates,
   task_id = TaskID
 };
 var aperesp = await POST.Request(Ape.api_methods.invoke_envoy, req);
 }
}