node.js - How to enable websocket in Azure bot service? -


how enable websocket option in azure bot service? there websocket option available in app service application settings missing in bot service.

i'm running nodejs bot sample template , added websocket.

"use strict"; var builder = require("botbuilder"); var botbuilder_azure = require("botbuilder-azure"); var path = require('path'); var useemulator = (process.env.node_env == 'development'); var websocket = require('ws'); var wss = new websocket.server({ port: process.env.port || 8080 });  var connector = useemulator ? new builder.chatconnector() : new botbuilder_azure.botserviceconnector({     appid: process.env['microsoftappid'],     apppassword: process.env['microsoftapppassword'],     stateendpoint: process.env['botstateendpoint'],     openidmetadata: process.env['botopenidmetadata'] });  var bot = new builder.universalbot(connector); bot.localepath(path.join(__dirname, './locale'));  bot.dialog('/', function (session) {     session.send('you said ' + session.message.text); });  if (useemulator) {     var restify = require('restify');     var server = restify.createserver();     server.listen(3978, function() {         console.log('test bot endpont @ http://localhost:3978/api/messages');     });     server.post('/api/messages', connector.listen());     } else {     module.exports = { default: connector.listen() } } 

this client side code

var ws = new websocket('ws://localhost:8080'); ws.onopen = function() {    console.log('connected'); }; ws.onclose = function() {    console.log('disconnected'); }; ws.send('test message websocket client') 

this working in local emulator i'm getting 503 response code when tried connect azure server

var ws = new websocket('ws://mybotname.azurewebsites.net'); 

also tried port 8080 i'm getting connection timeout error.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -