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

BUG: When using websocket connetion gofr is using closed connection #1527

Open
vipul-rawat opened this issue Feb 25, 2025 · 0 comments · May be fixed by #1532
Open

BUG: When using websocket connetion gofr is using closed connection #1527

vipul-rawat opened this issue Feb 25, 2025 · 0 comments · May be fixed by #1532
Labels
bug Something isn't working

Comments

@vipul-rawat
Copy link
Member

vipul-rawat commented Feb 25, 2025

Describe the bug
When using the below code to use websocket connection

To Reproduce
Steps to reproduce the behavior, if applicable:

  1. The code is

    package main
     
     import (
     	"github.com/gorilla/websocket"
     	"gofr.dev/pkg/gofr"
     )
     
     func main() {
     	app := gofr.New()
     
     	app.WebSocket("/ws", WSHandler)
     
     	app.Run()
     }
     
     func WSHandler(ctx *gofr.Context) (any, error) {
     	conn := ctx.GetConnectionFromContext(ctx)
     	defer conn.Close()
     
     	conn.WriteMessage(websocket.TextMessage, []byte("Hello, World!"))
     
     	return nil, nil
     }
  2. The error is

Image

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environments (please complete the following information):

  • OS: [e.g. Linux]
  • gofr version [e.g. v1.5.0]
  • go version [e.g. 1.21]

More description
Add any other context about the problem here.

@vipul-rawat vipul-rawat added the bug Something isn't working label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant