Open subssn21 opened 4 years ago
Seems like a reasonable use case. It might be challenging to implement. We're calling configure with parameters we get from the event object passed in to our web socket handler. In order to call configure from all handlers, we'd have to get the domain name and stage from somewhere else besides the event object. Maybe we can record it somewhere at deploy time.
Any thoughts @stealthycoin?
It looks like it is already stored in /chalice/deployed/{env}.json
In the websocket_api section.
Can that be read by Chalice inside the Lambda?
Are there any updates on the issue?
Yeah I'm trying to do the same thing by combining sockets and SNS events. Basically having devices connect to the socket and get messages over the socket from a lambda that is invoked via an SNS event.
I am working with the experimental Websockets API, and so far it is working great.
The one issue I did run into was that I want to send a message to my websocket from for instance my SQS Queue when it was done processing an item on the queue.
Now keeping track of the connection ID is clearly the application developers job, however access the send api was a problem.
websocket_api.configure is not called except for websocket handlers.
I was able to work around it by setting the api URL in an environment variable and checking to see if _endpoint_url has been set and set it if not.
Everything work after that.
So the request is to call configure on websocket_api for all handlers regardless of being websocket or not (or make it easy to do in app.py)
There may. be a better way already and I am just not aware of it.
Thanks,
Mike