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

Add Server Side Events endpoint #75

Merged
merged 5 commits into from
Sep 27, 2023
Merged

Add Server Side Events endpoint #75

merged 5 commits into from
Sep 27, 2023

Conversation

Uxio0
Copy link
Member

@Uxio0 Uxio0 commented Sep 8, 2023

Add an endpoint to subscribe to Server Side Events. Events will have the same format as the webhook ones. Also, when subscribing to a Safe, if the Safe is present in multiple chains all the events will be received.

New endpoint will be /events/sse/<checksummedSafeAddress>

@Uxio0 Uxio0 changed the title WIP Server side events Support Server Side Events Sep 12, 2023
@Uxio0 Uxio0 marked this pull request as ready for review September 12, 2023 12:02
@Uxio0 Uxio0 requested a review from moisses89 as a code owner September 12, 2023 12:02
@Uxio0 Uxio0 changed the title Support Server Side Events Add Server Side Events endpoint Sep 12, 2023
return this.eventsService.getEventsObservableForSafe(safe);

throw new BadRequestException('Not valid EIP55 address', {
description: `${safe} is not a valid EIP55 Safe address`,
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider check if the address is a Safe address?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would add too many dependencies for the service, in my opinion

Copy link
Member Author

Choose a reason for hiding this comment

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

But it's a good observation, depending on traffic we have to think on how to protect this endpoint, maybe a flag to disable the feature in the future

@Uxio0 Uxio0 merged commit 7310a31 into main Sep 27, 2023
8 checks passed
@Uxio0 Uxio0 deleted the sse branch September 27, 2023 14:35
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 subscriptions from external websocket
2 participants