标题翻译
Using AWS Alexa in Java to start a Desktop app
问题
我在考虑制作一个Alexa技能,允许用户在他们的电脑上启动游戏或桌面应用程序。我正在考虑让电脑运行一个Java服务器,并使用JSON配置来命名键,这些键与启动游戏的命令相匹配,例如:
{
"serverPort": 9023,
"apps": {
"minecraft": { // Alexa用于启动游戏的名称
"command": "minecraft.exe", // 桌面将执行的命令
},
"fortnite": {
"command": "fortnite.exe"
}
}
}
Alexa技能将连接到服务器,使用在首次链接时创建的令牌对服务器(PC)和客户端(Alexa)进行身份验证,然后发送一个数据包告诉服务器要启动什么游戏。服务器将以成功数据包或失败数据包作出响应,然后连接关闭。
我从未使用过AWS,对于AWS Lambda的了解也很少,这就是为什么我在询问这个设置。我需要自己托管这个吗,还是在AWS Lambda的免费层次下可以实现?此外,连接Alexa和PC的最佳方法是什么,可能稍后还要允许链接多台电脑?
附言:我打算在客户端和服务器中使用Netty进行网络通信。
英文翻译
I am thinking about making an Alexa skill that would allow people to start a game or desktop app on their PC. I am thinking about having the PC running a Java server and using a JSON config to name keys that match to the command to start the game such as this:
{
"serverPort": 9023,
"apps": {
"minecraft": { // Name Alexa uses to start game
"command": "minecraft.exe", // Command the Desktop will execute
},
"fortnite": {
"command": "fortnite.exe"
}
}
}
The Alexa skill will connect to the server, authenticate both server (PC) and client (Alexa) using a token created when they were first linked and then send a packet telling the server what game to start. The server will either respond with a success packet or a failure packet and then the connection closes.
I've never used AWS and even less know of AWS Lambda so that is why I am asking about this setup. Would I need to self-host this or is it possible with the free tier of AWS Lambda? And also, what would be the best way to link both Alexa and PC, and possibly later on allow multiple PCs to be linked?
P.S I am going to use Netty for the networking in both client and server
答案1
得分: 0
好的,使用 Lambda 与服务器有一些不同。每当您向 Lambda 请求某些内容时,它会启动并为您提供所需内容,然后关闭。这意味着您不需要让某个内容持续运行 24 小时,而是可以让 Lambda 根据请求的到来进行处理。而对于服务器来说,基本上也是类似的,只是它会持续运行 24 小时。
我不确定 Lambda 是否适用,以及它可以处理多少个请求,但您可以进行相关研究。
希望能对您有所帮助
英文翻译
Ok so with Lambda it a bit different than a server. Whenever you ask lambda for something it turns on and delivers for you and then turns off. This means you don't have to have something running for 24 hours and can just have lambda deal with requests as they come. With a server its basically the same thing except its running for 24 hours.
I'm not sure if lambda would work or how many requests lambda can handle, but you could look into it.
I hope i helped
专注分享java语言的经验与见解,让所有开发者获益!
评论