Skip to content

Instantly share code, notes, and snippets.

View zakisk's full-sized avatar
💭
Learning cloud native technologies

zakisk

💭
Learning cloud native technologies
View GitHub Profile
@zakisk
zakisk / events.go
Created October 9, 2023 13:51
How to send events from Golang
func (h *Handler) KubernetesPingHandler(w http.ResponseWriter, req *http.Request, _ *models.Preference, user *models.User, provider models.Provider) {
userID := uuid.FromStringOrNil(user.ID)
token, ok := req.Context().Value(models.TokenCtxKey).(string)
if !ok {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "failed to get the token for the user")
return
}
connectionID := req.URL.Query().Get("connection_id")