Refactor WebSocket
- Dominant language
- Go
- Stars
- 20.9k
- Forks
- 1.8k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 39
Description
If you refer to this test that I have added : https://github.com/gofr-dev/gofr/blob/14e1c54ddc677d9bc752e50f34a546e7a1d61fe4/pkg/gofr/context_test.go#L82 , you will notice, we need to mention a number of things while implementing a web socket handler. This is not at all intuitive and a better design pattern need to be accommodated/extended.
It is currently implemented the same way, that is HTTP and web sockets both accept only context in their handlers. Modifying the signature will be a breaking change. However we can go around it. Wanted to hear his/her's internal implementation. It is not very robust in current situation(user has to himself write and handle multiple edge cases) and there is no observability as well.
Also web sockets, HTTP, gRPC all follow a similar hander signature for abstraction, with `*gofr.Context` support.
Contributor guide
Research direction
Start with pkg/gofr/context_test.go around the referenced WebSocket test at line 82, then compare the current WebSocket, HTTP, and gRPC handler signatures. The work needs a decided non-breaking design that reduces caller-managed edge cases and adds observability; the issue does not specify the target API or implementation files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100