简体   繁体   中英

what does the following error on websocket mean and how to fix it

I am trying to connect my ALEXA skill kit through lambda function to ROS (running on my ubutnu VM machine) via web sockets. The problem is web sockets connection is not being established. I get the following error message:

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 } }
  • WebSocket URL '192.168.0.20' is a local address. if you are using AWS Lambda, then your lambda function can not connect to '192.168.0.20'. Because they are not on the same network

  • If your Alexa kit and WebSocket on the same network, Because of VM they will not on the exact same network. VM creates its own network

@hasbi has the right answer to why you are getting this error.

As a work around, consider using a tunneling service such as ngrok (free).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM