I'm struggling to make bot-framework-emulator and Bot Builder for Node.js Builder work under Linux.
As bot-framework-emulator for Linux requires mono, I decided to run it under Docker with following Dockerfile:
FROM mono:latest
EXPOSE 9000
COPY . BotFrameworkEmulator-Console/
CMD [ "mono", "./BotFrameworkEmulator-Console/BFEmulator.exe" ]
I'm starting it with command (also expose port 9000):
docker run -it --rm -p 9000:9000 bfemulator
It starts just fine and seems working. And here is the first question. bot-framework-emulator page declares:
For folks who are developing on Mac and Linux we have created a console only version which works using mono.
Does it mean that it doesn't contain web interface as Windows variant of bot emu? Because netstat -al reports than BFEmulator.exe is listening on port 9000, but is not accessible from docker host when I visit localhost:9000. It's not accessible neither from inside docker container.
Second issue is than I cannot even use console mode of BFEmulator. On my host I'm running nodejs docker bot example, which is working fine when deployed to "Microsoft Bot Framework".
Here is the example code:
var restify = require('restify');
var builder = require('botbuilder');
//=========================================================
// Bot Setup
//=========================================================
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});
// Create chat bot
var connector = new builder.ChatConnector({
appId: process.env.npm_package_config_MICROSOFT_APP_ID,
appPassword: process.env.npm_package_config_MICROSOFT_APP_PASSWORD
});
var bot = new builder.UniversalBot(connector);
server.post('/api/messages', connector.listen());
//=========================================================
// Bots Dialogs
//=========================================================
bot.dialog('/', [
function (session) {
builder.Prompts.text(session, 'Hi! What is your name?');
},
function (session, results) {
session.send('Hello %s!', results.response);
}
]);
But when running with BFEmulator, the bot server above reports:
ChatConnector: message received.
Error: Request to 'http://172.17.0.1:3978/v3/botstate/emulator/users/617d3bf8' failed: [404] Not Found
at Request._callback (/home/finch/dev/mapilary/mapilary-bot/node_modules/botbuilder/lib/bots/ChatConnector.js:413:46)
at Request.self.callback (/home/finch/dev/mapilary/mapilary-bot/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/home/finch/dev/mapilary/mapilary-bot/node_modules/request/request.js:1060:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/home/finch/dev/mapilary/mapilary-bot/node_modules/request/request.js:980:12)
at IncomingMessage.g (events.js:291:16)
at emitNone (events.js:91:20)
I understand that path v3/botstate/emulator/users is not declared in bot example. So my question is possible to use emulator with nodejs bot builder?