Open anmol098 opened 1 year ago
Hi,
I have the same issue as above.
I tried connecting via insomnia or wscat to ws://localhost:4000
but I get:
wscat error:
insomnia error:
sls offline:
Serverless config:
service: websocket
frameworkVersion: "3"
plugins:
- serverless-webpack
- serverless-offline
provider:
name: aws
runtime: nodejs14.x
websocketsApiName: websockets-api
websocketsApiRouteSelectionExpression: $request.body.action
custom:
serverless-offline:
websocketPort: 4000
functions:
- socket-connect:
handler: src/socket.connect
events:
- websocket:
route: $connect
package.json dependencies version:
"serverless": "^3.24.1",
"serverless-offline": "^12.0.4",
"serverless-webpack": "^5.8.0",
Am I missing something as well? (the webpack is for typescript codes)
I have a node project and I have created websocket with serverless and it's running on port 6000. When I try to connect from wscat it's able to connect
wscat -c ws://localhost:6000.
But when I try to connect from browser using Websocket browser api it fails to connect the connect request is not even reaching the lambda function On browser I am using
new WebSocket('ws://localhost:6000') Browser just throws error connection failed with no reason.
When I deploy cloud formation file to aws that websocket I am able to connect
Please help if I am missing anything.