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

WebsocketEvent enum problems #32

Open
alexgleason opened this issue Feb 25, 2024 · 1 comment
Open

WebsocketEvent enum problems #32

alexgleason opened this issue Feb 25, 2024 · 1 comment

Comments

@alexgleason
Copy link

In consumer code it is not possible to use a string in the event listener:

image

The only way is to import the the WebsocketEvent enum and use WebsocketEvent.open. IMO this should not be an enum at all, but an interface similar to the native WebSocketEventMap in TypeScript:

interface WebSocketEventMap {
  close: CloseEvent;
  error: Event;
  message: MessageEvent;
  open: Event;
}
@alexgleason
Copy link
Author

I made the greatest Nostr relay class ever using this library. Thank you for your service! https://gitlab.com/soapbox-pub/NSpec/-/blob/main/src/NRelay.ts

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

No branches or pull requests

1 participant