diff --git a/CSharp/core-DirectLineWebSockets/DirectLineClient/Program.cs b/CSharp/core-DirectLineWebSockets/DirectLineClient/Program.cs index 38f0e7a2bf..c415d83786 100644 --- a/CSharp/core-DirectLineWebSockets/DirectLineClient/Program.cs +++ b/CSharp/core-DirectLineWebSockets/DirectLineClient/Program.cs @@ -30,11 +30,14 @@ public static void Main(string[] args) private static async Task StartBotConversation() { - var directLineClient = new DirectLineClient(directLineSecret); - + // Obtain a token using the Direct Line secret + var tokenResponse = await new DirectLineClient(directLineSecret).Tokens.GenerateTokenForNewConversationAsync(); + + // Use token to create conversation + var directLineClient = new DirectLineClient(tokenResponse.Token); var conversation = await directLineClient.Conversations.StartConversationAsync(); - using(var webSocketClient = new WebSocket(conversation.StreamUrl)) + using (var webSocketClient = new WebSocket(conversation.StreamUrl)) { webSocketClient.OnMessage += WebSocketClient_OnMessage; webSocketClient.Connect(); @@ -100,10 +103,11 @@ private static void WebSocketClient_OnMessage(object sender, MessageEventArgs e) } } } + Console.Write("Command> "); } } - + private static void RenderHeroCard(Attachment attachment) { const int Width = 70;