-
-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow WebSocket responses to be sent by handler responses #1008
Comments
Another way to repro this issue is simply to run the project's WebSocket example. When I run it, the return values do not get returned to the client in any form. |
Another interesting point is that if I put code in the handler that throws an unhandled error, the WebSocket client does receive a message with the error message, ‘Internal server error’. At least there is some form of two-way communication working! |
+1 |
This should be an easy fix. @frozenbonito what do you think? |
serverless-offline/src/events/websocket/WebSocketClients.js Lines 84 to 93 in e3ec399
The |
fixed with: #1301 |
Feature Request
It is currently possible to use
ApiGatewayManagementApi.postToConnection
to respond to an incoming WebSocket message as detailed in thereadme.
However, it would be great to have
serverless-offline
act in the same way as API Gateway's WebSocket APIs are able to, meaning that thebody
in the return value of the handler is sent back to the connected client as a WebSocket message.Sample Code
Expected behavior/code
If I were to deploy to AWS and run the following code in browser:
...I would expect to see a WebSocket message come back straight away in response. However, when running locally:
...the WebSocket connection is successful and any logs will show in the serverless console, but no response WebSocket message will be sent.
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: