Skip to content

Refactor WebSocket #2238

@coolwednesday

Description

@coolwednesday

If you refer to this test that I have added :

func TestContext_WriteMessageToSocket(t *testing.T) {
, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions