I'm toying around with API Gateways Websocket APIs...
# help
s
I'm toying around with API Gateways Websocket APIs. I've used SST to deploy my lambdas that handle connect/disconnect/default paths. I manually wired up the websocket API via the AWS console in API Gateway. I'm taking a stab at reproducing the whole setup via SST.
I know the SST API construct only currently supports HTTP APIs, so I'll have to use CDK directly to define the API. What I'm fuzzy on is how to connect my SST defined functions to a CDK generated API
f
@Seth Geoghegan don’t look at the DebugStack implementation, i wrote that b4 CDK supported websocket
s
ahh, glad I asked 🙂
cuz, I'm hella confused 😕
But yeah.. that’s definitely something we want to add a construct for down the road
s
ahh, that looks promising
Yeah, I figured as much. Probably not a top tier use-case for API Gateway, but a nice construct to have in place
f
yup.. to help with setting custom domain, access log and stuff
s
I connected to the endpoint using https://www.websocket.org/echo.html, which fired off my wsConnect Function and added the connection info to DynamoDB
with the functions running on my laptop via SST start
I'm still not over how cool that is
f
Nice! I just opened a discussion with ur example to help us implement it when we get to it https://github.com/serverless-stack/serverless-stack/discussions/268
s
I am hacking together a serverless chat to learn this part of API Gateway. If it comes together, I'll have to write something up
so far, so good 🙂
The example i posted is making use of the SST Table construct to
addConsumers
My app saves chat messages to DDB, which fires off a stream, which I then use websockets to broadcast the message to connected clients
Definitely 🤓
the websocket API is the only thing that wasn't entirely in SST
f
Hey @Seth Geoghegan, just looping back to this, we added the
sst.WebSocketApi
construct. Here’s a link to the doc - https://docs.serverless-stack.com/constructs/WebSocketApi
s
Awesome!