Skip to content

Add Example for WebSocket with Authentication Middleware #1699

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

Open
pankaj-bind opened this issue May 8, 2025 · 8 comments
Open

Add Example for WebSocket with Authentication Middleware #1699

pankaj-bind opened this issue May 8, 2025 · 8 comments

Comments

@pankaj-bind
Copy link

Currently, the GoFr examples directory (examples/) includes a WebSocket example (using-web-socket/), but it does not demonstrate how to integrate WebSocket connections with authentication middleware, such as the built-in Auth Middleware. This could be a common use case for developers building secure real-time applications, and an example would help showcase GoFr's capabilities in combining WebSocket and authentication.

@coolwednesday
Copy link
Contributor

coolwednesday commented May 15, 2025

Hey @pankaj-bind ,

You're absolutely right — we should definitely add examples for this in the examples directory, and that's something we plan to do soon!

In the meantime, if you're facing any specific issues or blockers while implementing authentication in websocket, feel free to share the details along with a code snippet and the error or unexpected behavior you're encountering. We’d be happy to help out.

Thanks again!

@pankaj-bind
Copy link
Author

@coolwednesday May I submit a PR to fix this issue?

@coolwednesday
Copy link
Contributor

@coolwednesday May I submit a PR to fix this issue?

Sure, go ahead!

If by fixing the issue you meant, adding examples.......please check out the grpc-example folder for reference. Following a similar structure, create two new subfolders:

  • websocket
  • websocket-with-authentication

We’d also encourage you to write an article explaining the authentication setup (if any)—especially if you're implementing JWT or API key-based authentication. This article can serve as a helpful reference alongside the example you add. Of course, this second part is optional, but it would be a valuable addition.

@TJ456
Copy link

TJ456 commented May 15, 2025

Hey @coolwednesday can you please check the PR i thing i have solved this ....tried my best

@Umang01-hash
Copy link
Member

@pankaj-bind Please have a look at PR #1715 and let us know if it resolves your issue.

@TJ456 Thank you so much for solving the issue.
While it might be important to extend the WebSocket documentation to include examples of using auth middleware, adding a separate example or modifying the existing one might make it complex for users who simply want to use WebSockets out of the box.

@Umang01-hash
Copy link
Member

@pankaj-bind is your query/issue resolved?

@pankaj-bind
Copy link
Author

pankaj-bind commented May 29, 2025

@Umang01-hash, @TJ456 hasn't updated it yet. Can I fix it?

@TJ456
Copy link

TJ456 commented May 29, 2025

@pankaj-bind yes sorry, go ahead ..I am facing some helath issue and rn no in my place ..sorry I waited you so long

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

4 participants