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

Presence channel handler #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jdavidbakr
Copy link
Contributor

Finishes #23

member_added presence completed

Presence channel logic
@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #25 (db495f1) into master (2031401) will decrease coverage by 1.88%.
The diff coverage is 32.55%.

@@             Coverage Diff              @@
##             master      #25      +/-   ##
============================================
- Coverage     45.30%   43.42%   -1.89%     
- Complexity       61       71      +10     
============================================
  Files             9        9              
  Lines           373      456      +83     
  Branches         14       14              
============================================
+ Hits            169      198      +29     
- Misses          196      250      +54     
  Partials          8        8              
Flag Coverage Δ
jest 51.14% <0.00%> (-2.46%) ⬇️
pest-8.0 40.30% <35.00%> (-0.83%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
js-src/Channel.ts 33.33% <0.00%> (-6.67%) ⬇️
src/SubscriptionRepository.php 8.45% <0.00%> (-5.84%) ⬇️
src/Handler.php 64.33% <53.06%> (-2.34%) ⬇️
src/ConnectionRepository.php 87.50% <100.00%> (+0.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2031401...db495f1. Read the comment docs.

@jdavidbakr
Copy link
Contributor Author

Not sure how to test the presence channels, it fails when I try because of the authorization check

// GoneException: The connection with the provided id no longer exists.
if ($e->getAwsErrorCode() === 'GoneException') {
// GoneException: The connection with the provided id no longer exists.
if ($e->getStatusCode() === Response::HTTP_GONE) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this? AWS doesnt return a standard HTTP gone exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had to change it because I was not getting the 'GoneException' but was getting the HTTP Gone exception instead. Maybe we should keep both cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed an update that responds to both exceptions.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So AWS does a real poor job on documenting this. Their Python and Java SDK's speak about a separate GoneException, not a HTTP exception: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/apigatewaymanagementapi.html#ApiGatewayManagementApi.Client.post_to_connection

This sets me to believe the error will just be 400 and the actual error is in the respone body. The SDK will map it to the approriate exception.

Is this really the case? I don't know. The string version doesnt seem to work so perhaps you are right.

Have to tested this behavior with an actual API? If so, I believe you and will be happy to merge.

Sorry for all the questions. But this has been a long standing issue, and really want to get it fixed for good ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was working directly with the AWS API Gateway when I made this change. It was the only way I could avoid errors when doing presence removals. I did update the PR to include both cases, in case there is a situation where the other one is necessary.

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.

None yet

2 participants