Serverless with REST and WSS

api-gateway
#1

Hi,

I looked into https://github.com/serverless/serverless/pull/5824 and https://serverless.com/framework/docs/providers/aws/events/websocket/ but I still could not manage to create a service that provides a REST endpoint and a WSS endpoint.

All I see when I deploy is the REST interface which was created before I added the websockets functions.

endpoints:
  POST - https://xxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/graphql
functions:
  graphql: serviceName-graphql-dev-graphql
  connectHandler: serviceName-graphql-dev-connectHandler
  disconnectHandler: serviceName-graphql-dev-disconnectHandler
  defaultHandler: serviceName-graphql-dev-defaultHandler
layers:
  None
Serverless: Removing old service artifacts from S3...

I’m very new to this, so any guidance is appreciated. Thanks!

I can see they are bundled in the same api gateway “graphql-dev”. Is there a way to separate this?

0 Likes

#2

Apparently it was a lack of indentation in the “route” keyword.

I had it before

events:
  - websocket:
   route: $disconnect

and serverless wants

events:
  - websocket:
      route: $disconnect
0 Likes