Exemple #1
0
 public BotController(IBotFrameworkHttpAdapter adapter, BylinasBot bylinasBot,
                      SphereOfWorldsBot sphereOfWorldsBot, BylinasService bylinasService,
                      SphereOfWorldsService sphereOfWorldsService)
 {
     _adapter               = adapter;
     _bylinasBot            = bylinasBot;
     _sphereOfWorldsBot     = sphereOfWorldsBot;
     _bylinasService        = bylinasService;
     _sphereOfWorldsService = sphereOfWorldsService;
 }
Exemple #2
0
        private async Task ReadDataLoop(string conversationId, TcpClient tcpClient, ConversationReference conversationReference)
        {
            while (true)
            {
                if (!tcpClient.Connected)
                {
                    CloseTcpClient(conversationId, tcpClient);
                    return;
                }

                string message = await ReadData(tcpClient);

                if (string.IsNullOrEmpty(message))
                {
                    tcpClient.Client.Disconnect(false);
                    _logger.LogInformation("Disconnected TcpClient for conversationId={0}", conversationId);
                    continue;
                }

                await((BotAdapter)_adapter).ContinueConversationAsync(_appId, conversationReference,
                                                                      async(context, token) => await SphereOfWorldsBot.BotCallback(message, context, token),
                                                                      default(CancellationToken));
            }
        }