@@ -14,10 +14,7 @@ const restify = require('restify');
1414
1515// Import required bot services.
1616// See https://aka.ms/bot-services to learn more about the different parts of a bot.
17- const {
18- CloudAdapter,
19- ConfigurationBotFrameworkAuthentication
20- } = require ( 'botbuilder' ) ;
17+ const { CloudAdapter, loadAuthConfigFromEnv } = require ( '@microsoft/agents-hosting' ) ;
2118
2219// This bot's main dialog.
2320const { EchoBot } = require ( './bot' ) ;
@@ -32,7 +29,7 @@ server.listen(process.env.port || process.env.PORT || 3978, () => {
3229 console . log ( '\nTo talk to your bot, open the emulator select "Open Bot"' ) ;
3330} ) ;
3431
35- const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication ( process . env ) ;
32+ const botFrameworkAuthentication = loadAuthConfigFromEnv ( )
3633
3734// Create adapter.
3835// See https://aka.ms/about-bot-adapter to learn more about how bots work.
@@ -68,15 +65,16 @@ const myBot = new EchoBot();
6865// Listen for incoming requests.
6966server . post ( '/api/messages' , async ( req , res ) => {
7067 // Route received a request to adapter for processing
68+ // @ts -ignore
7169 await adapter . process ( req , res , ( context ) => myBot . run ( context ) ) ;
7270} ) ;
7371
74- // Listen for Upgrade requests for Streaming.
75- server . on ( 'upgrade' , async ( req , socket , head ) => {
76- // Create an adapter scoped to this WebSocket connection to allow storing session data.
77- const streamingAdapter = new CloudAdapter ( botFrameworkAuthentication ) ;
78- // Set onTurnError for the CloudAdapter created for each connection.
79- streamingAdapter . onTurnError = onTurnErrorHandler ;
72+ // // Listen for Upgrade requests for Streaming.
73+ // server.on('upgrade', async (req, socket, head) => {
74+ // // Create an adapter scoped to this WebSocket connection to allow storing session data.
75+ // const streamingAdapter = new CloudAdapter(botFrameworkAuthentication);
76+ // // Set onTurnError for the CloudAdapter created for each connection.
77+ // streamingAdapter.onTurnError = onTurnErrorHandler;
8078
81- await streamingAdapter . process ( req , socket , head , ( context ) => myBot . run ( context ) ) ;
82- } ) ;
79+ // await streamingAdapter.process(req, socket, head, (context) => myBot.run(context));
80+ // });
0 commit comments