Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.
This repository was archived by the owner on May 24, 2023. It is now read-only.

Access to fiber.Ctx #94

Open
Open

Description

@GarryGaller

How to access c.Locals ( where c is *fiber.Ctx) from a custom the websocket handler?

Activity

  1. ReneWerner87 commented on Feb 20, 2022

    @ReneWerner87
    Member
  2. GarryGaller commented on Feb 20, 2022

    @GarryGaller
    Author

    This is not the c.Locals object I need.
    You need ctx.Locals, where cts is fiber.Ctx
    The c.Locals cannot have a value set. You can only read it.

  3. Bastardly commented on Mar 30, 2022

    @Bastardly

    @GarryGaller
    I'm not completely sure what you aim to do. But here's an example where I bring fiber.Ctx into scope.

    	app.Get("/ws/:id", func (ctx *fiber.Ctx) error {
    		s := getSession(ctx)
    
    		handler :=  websocket.New(func (c *websocket.Conn) {
    			webSocketHandler(c, s)
    		})
    
    		return handler(ctx)
    	})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤔 QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions