首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将websockets与Alexa技能包结合使用

将websockets与Alexa技能包结合使用
EN

Stack Overflow用户
提问于 2016-06-28 05:37:34
回答 1查看 1.9K关注 0票数 0

我有一个用node js编写的hello world alexa技能,并将其部署在heroku中。我必须使用websockets将响应发送到web ui(比如我本地机器中的html页面).Is这是可能的吗?

我的服务器代码-server.js

代码语言:javascript
复制
'use strict';

var AlexaAppServer = require( 'alexa-app-server' );

var server = new AlexaAppServer( {
 httpsEnabled: false,
 port: 8080
} );

server.start();

下面是index.js

代码语言:javascript
复制
 module.change_code = 1;
  'use strict';

var alexa = require( 'alexa-app' );
var app = new alexa.app('Helloworld');


 app.launch( function( request, response ) {
console.log(app);
//console.log(request);
response.say( 'Welcome to Welcome to helloworld.' );

});

app.error = function( exception, request, response ) {
 console.log(exception)
 console.log(request);
 console.log(response); 
 response.say( 'Sorry an error occured ' + error.message);
};

app.intent('Helloworld',
{
 "slots":[]
 ,"utterances":[ 
    "hello alexa",
    "hi alexa",
    "how are you?"]
},
function(request,response) {

  response.say("welcome user");
//send this same response to a webpage using socket

}
);


module.exports = app;
EN

回答 1

Stack Overflow用户

发布于 2018-03-20 22:43:25

你是否正在尝试做html页面与alexa的互动。如果你是对的,你必须使用websocket,但你可以尝试AWS本身提供的API网关,在API网关中,你可以调用它到你的html页面,这个链接可能会对你有所帮助。https://blog.prototypr.io/using-voice-commands-to-control-a-website-with-amazon-echo-alexa-part-1-6-a35edbfef405

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38063669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档