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

feat: Pluggable Management Api #11

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

Conversation

reconbot
Copy link
Contributor

Say you want to use a custom endpoint for your management api communication. Say you want specific configuration? Well now you can! By providing an already constructed management api class. If you don't want to, no problem, we'll assume your endpoint for you from the incoming websocket event.

  • Added optional ServerArgs.apiGatewayManagementApi
  • Refactored Event types to use a APIGatewayWebSocketEvent with a context that always has a domainName and connectionID. We were using ! for these fields before. Hopefully we can push this into aws-lambda and use use their events.

TODO:

  • Doc updates in the readme if this approach is sound
  • Decide if we should put https into the generated endpoint domain

closes #8

@andyrichardson
Copy link
Owner

Hopefully we can push this into aws-lambda and use use their events.

Totally agree! I think there was some kind of confusion that a lot of these websocket context attributes are optional (source)

Copy link
Owner

@andyrichardson andyrichardson left a comment

Choose a reason for hiding this comment

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

@reconbot this is great - thanks for getting it in!

A few small suggestions below - if they're not clear or you just don't have time, let me know and I'll merge this as-is 👍

@reconbot
Copy link
Contributor Author

Unless you got big objections I'd be happy to have this merge as is. This change lets me drop my fork ;-)

@reconbot reconbot force-pushed the reconbot/pluggable-management-api branch from 7466676 to 188a7d6 Compare June 30, 2021 21:13
@reconbot
Copy link
Contributor Author

reconbot commented Jun 30, 2021

I pushed a type check fix - opened #12 to run ci on prs

@reconbot
Copy link
Contributor Author

Ahh I forgot my own todo items! I'll get on that

@reconbot
Copy link
Contributor Author

Pushed some docs

Decide if we should put https into the generated endpoint domain

What do you think? It seems to work as is, so I'm alright with it.

@reconbot reconbot force-pushed the reconbot/pluggable-management-api branch from 6091b97 to 5fa1884 Compare June 30, 2021 22:36
@reconbot
Copy link
Contributor Author

reconbot commented Jul 1, 2021

Let me know what you want to do with the closures. I pushed the types.

@andyrichardson
Copy link
Owner

Merged a few of your PRs - will get back to this one some time this week 💯

@reconbot
Copy link
Contributor Author

Ftr this is working well on my fork

reconbot added 3 commits July 17, 2021 07:55
Say you want to use a custom endpoint for your management api communication. Say you want specific configuration? Well now you can! By providing an already constructed management api class. If you don't want to, no problem, we'll assume your endpoint for you from the incoming websocket event.

- Added optional ServerArgs.apiGatewayManagementApi
- Refactored Event types to use a APIGatewayWebSocketEvent with a context that always has a domainName and connectionID. We were using `!` for these fields before. Hopefully we can push this into `aws-lambda` and use use their events.

TODO:
- Doc updates in the readme if this approach is sound
- Decide if we should put https into the generated endpoint domain
@reconbot reconbot force-pushed the reconbot/pluggable-management-api branch from 19c8560 to 1ed07a4 Compare July 17, 2021 11:57
@reconbot
Copy link
Contributor Author

attempted a rebase

@reconbot reconbot force-pushed the reconbot/pluggable-management-api branch from 39beefa to 26e3cfc Compare July 18, 2021 00:29
@reconbot reconbot force-pushed the reconbot/pluggable-management-api branch from 26e3cfc to 4806f8a Compare July 18, 2021 00:31
@reconbot
Copy link
Contributor Author

I've successfully finished rebasing and extending to the new ping/pong functionality. I'll give it some manual testing on my project

@reconbot
Copy link
Contributor Author

This changes the input objects to the handler function so it doesn't match aws-lambda. That's probably not desirable.

@andyrichardson
Copy link
Owner

I've been meaning to come back to this - plan to give it another pass over the next week

@reconbot
Copy link
Contributor Author

In production I lightened up the types to match only the apis and arguments we use to allow for adapters.

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.

Add sendMessage handler
2 participants