Hi, Am trying to implement a case where a client sends a POST request to subscribe to some service to a server including a "nfStatusNotificationUri" in the JSON data. The server responds with the subscription data, however after some time if there is a change in the subscritpion information in the server, the server have to send notification to the client about the changes. I currently do not have an idea how to do this. I have implemented the POST subscription part but ave no idea how to implent the notification part. Need help about how to do this. Thanks in advance.
This what i have done so far: // server // functions func (m *NfInstanceDataAccess) Insertsub(nfinstancesub Subscriptions) error { err := db.C(COLLECTION).Insert(&nfinstancesub) return err } func CreateNewSubscriptionPost(w http.ResponseWriter, r *http.Request) { var nfinstancesub Subscriptions id := uuid.New() subscriptionID := id.String() if r.Header.Get("Accept") != "application/json" { WriteError(w, ErrNotAcceptable) return } if err := json.NewDecoder(r.Body).Decode(&nfinstancesub); err != nil { respondWithError(w, http.StatusBadRequest, "Invalid request payload") return } nfinstancesub.ID = bson.NewObjectId() nfinstancesub.SubscriptionID = subscriptionID if err := da.Insertsub(nfinstancesub); err != nil { respondWithError(w, http.StatusInternalServerError, err.Error()) return } w.Header().Set("Response-Code", "201") w.Header().Set("Response-Desc", "Success") w.Header().Set("Cache-Control", "max-age=2592000") // 30 days respondWithJson(w, http.StatusCreated, nfinstancesub) } // Main function func main() { http.HandleFunc("/nnrf-nfm/v1/subscriptions, CreateNewSubscriptionPost) log.Fatal(http.ListenAndServe(":8080", nil)) } The JSON data to request subscription including the notification uri "nfStatusNotificationUri". Am using mongodb to store this json data request is sent. { "nfStatusNotificationUri": "string", "subscriptionID": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "validityTime": "2019-02-11T09:45:52.015Z", "reqNotifEvents": [ "NF_REGISTERED", "string" ], "plmnId": { "mcc": "string", "mnc": "string" }, "notifCondition": { "monitoredAttributes": [ "string" ], "unmonitoredAttributes": [ "string" ] }, "reqNfFqdn": "string" } Thanks in advance. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.