Skip to content
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

fix: enable responses from result of lambda function #1064

Conversation

kevbot-git
Copy link

@kevbot-git kevbot-git commented Aug 19, 2020

Implements feature request #1008, fixes #1008

Drafting as I'm not yet sure of the best way to test... There doesn't seem to be much coverage on this file in particular—should I maybe do a per-file test WebSocketClients.test.js?

@moroine
Copy link
Contributor

moroine commented Aug 23, 2020

@kevbot-git I think for test we need this PR #814

@dherault
Copy link
Owner

dherault commented Oct 26, 2020

I'm willing to merge, can you explain more what you tried to achieve?

@kevbot-git
Copy link
Author

@dherault all I have done is here is attempted to more closely emulate the behaviour of AWS API Gateway WebSocket APIs, which send a response socket event when messages are received 😃

@coulson84
Copy link

Hi, just wondering what the status of this PR is? Is something blocking it being merged or is still under review? There has not been any further work on it in a while and we need this feature to be merged so that our dev stack will work. We can work around it at the moment by patching serverless-offline but it would be nice to have this PR merged so that we can use serverless-offline without patching it.
Thanks for all the great work on serverless-offline 👍

@kevbot-git
Copy link
Author

@coulson84 sorry for the late reply. I haven't looked at this in months but I've just pulled master over it and was looking at my code... I think I had understood the problem incorrectly at the time. I have changed the code so that it checks for the definition of a default route before sending the default Forbidden message. What do you think? I'll ready this for review since we don't have any tests in place for this file, from what I can tell

@kevbot-git
Copy link
Author

Hey @dherault, I reckon this PR is still good to include as it appears to make offline WebSockets more closely follow AWS Lambda's behaviour with default responses etc. I'm so happy to take criticism on the code but wondering what you reckon?

@kevbot-git kevbot-git marked this pull request as ready for review March 25, 2021 10:26
@coulson84
Copy link

I'm just on my phone at the moment so haven't looked at the code just now. I think it had already accounted for this in the PR but I think AWS doesn't return any response from the $connect route

@coulson84
Copy link

I was about to pester for this to be merged but it needs a quick tweak first. Any response from the $connect route is ignored in AWS so the call to websocketClient.send just needs to be wrapped in an if statement to prevent the body being sent in that condition. Other than that it should all be good afaik 👍

@dherault
Copy link
Owner

Hi can you rebase please? I'm back on the project and would love to merge this.

@dnalborczyk dnalborczyk force-pushed the master branch 2 times, most recently from d5ea86d to 22fd667 Compare October 9, 2022 02:13
@dnalborczyk dnalborczyk force-pushed the master branch 2 times, most recently from fdd1699 to 51a30e9 Compare October 15, 2022 19:39
@dnalborczyk dnalborczyk changed the title (#1008) Enable responses from result of lambda function fix: enable responses from result of lambda function Nov 3, 2022
@dnalborczyk
Copy link
Collaborator

superseded by: #1301

@dnalborczyk dnalborczyk closed this Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow WebSocket responses to be sent by handler responses
5 participants