2017-07-29 109 views
0

我想通过网络套接字通过lambda函数连接我的ALEXA技能套件到ROS(运行在我的ubutnu VM机器上)。问题是网络套接字连接没有建立。我收到以下错误信息:什么websocket上的以下错误的意思,以及如何解决它

Error connecting to websocket server: { Error: connect ETIMEDOUT 192.168.0.20:9090 
at Object.exports._errnoException (util.js:1018:11) 
at exports._exceptionWithHostPort (util.js:1041:20) 
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14) 
code: 'ETIMEDOUT', 
errno: 'ETIMEDOUT', 
syscall: 'connect', 
address: '192.168.0.20', 
port: 9090, 
type: 'error', 
target: 
WebSocket { 
domain: null, 
_events: 
{ open: [Object], 
close: [Object], 
error: [Object], 
message: [Object] }, 
_eventsCount: 4, 
_maxListeners: undefined, 
_socket: null, 
_ultron: null, 
_closeReceived: false, 
bytesReceived: 0, 
readyState: 0, 
supports: { binary: true }, 
extensions: {}, 
_isServer: false, 
url: 'ws://192.168.0.20:9090', 
protocolVersion: 13 } } 

回答

1
  • 的WebSocket URL '192.168.0.20' 是本地地址。如果您使用的是AWS Lambda,那么您的lambda函数无法连接到'192.168.0.20'。因为它们不在同一个网络上

  • 如果你的Alexa kit和WebSocket在同一个网络上,由于VM他们不会在完全相同的网络上。 VM创建自己的网络

+0

我能够使用node.js应用程序进行连接。此外,我正在使用桥接网络连接,以便我的Mac和VM共享互联网 – terpguy

0

@hasbi有正确的答案,为什么你得到这个错误。

作为解决方法,考虑使用隧道服务,如ngrok(免费)。

相关问题