Created
April 25, 2024 08:51
-
-
Save ilovelili/905447f2192b855677ab1e2fdcc21738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handle $connect event | |
func connectHandler(c echo.Context) error { | |
// Extract connection ID from headers | |
connectionID := c.Request().Header.Get("Sec-WebSocket-Protocol") | |
// Perform actions when a client connects | |
fmt.Printf("Client connected: %s\n", connectionID) // ==========> we didn't get the connectionID, it's empty | |
// Respond with a 200 status code | |
return c.String(http.StatusOK, "Connected") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment