Skip to content

Commit

Permalink
Merge pull request #63 from launchdarkly/eb/ch17401/meval
Browse files Browse the repository at this point in the history
add /meval mobile stream endpoint (pings only)
  • Loading branch information
eli-darkly authored Aug 9, 2018
2 parents 79f6d77 + 15e5f29 commit 9b90674
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ Endpoint | Method | Auth Header | Description
/ping | GET | sdk | SSE endpoint that issues "ping" events when there are flag data updates
/ping/*clientId* | GET | n/a | Same as above but with JS and client-side authorization.
/mping | GET | mobile | SSE endpoint that issues "ping" events when flags should be re-evaluated
/meval/*user* | GET | mobile | SSE stream of "ping" and other events for mobile clients
/meval | REPORT | mobile | Same as above but request body is user json object
/eval/*clientId*/*user* | GET | n/a | SSE stream of "ping" and other events for JS and other client-side SDK listeners
/eval/*clientId* | REPORT | n/a | Same as above but request body is user json object

Expand Down
Binary file removed ldr
Binary file not shown.
5 changes: 5 additions & 0 deletions relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ func (r *Relay) makeHandler() http.Handler {
msdkEvalXRouter.HandleFunc("/users/{user}", evaluateAllFeatureFlags).Methods("GET")
msdkEvalXRouter.HandleFunc("/user", evaluateAllFeatureFlags).Methods("REPORT")

mobileStreamRouter := router.PathPrefix("/meval").Subrouter()
mobileStreamRouter.Use(mobileMiddlewareStack)
mobileStreamRouter.HandleFunc("", countMobileConns(pingStreamHandler)).Methods("REPORT")
mobileStreamRouter.HandleFunc("/{user}", countMobileConns(pingStreamHandler)).Methods("GET")

router.Handle("/mping", r.mobileClientMux.selectClientByAuthorizationKey(countMobileConns(pingStreamHandler))).Methods("GET")

clientSidePingRouter := router.PathPrefix("/ping/{envId}").Subrouter()
Expand Down
2 changes: 2 additions & 0 deletions relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ func TestRelay(t *testing.T) {
{"flags stream", "GET", "/flags", sdkKey, nil, "put", expectedFlagsData},
{"all stream", "GET", "/all", sdkKey, nil, "put", expectedAllData},
{"mobile ping", "GET", "/mping", mobileKey, nil, "ping", nil},
{"mobile stream GET", "GET", "/meval/" + base64User, mobileKey, nil, "ping", nil},
{"mobile stream REPORT", "REPORT", "/meval", mobileKey, user, "ping", nil},
}

for _, s := range specs {
Expand Down

0 comments on commit 9b90674

Please sign in to comment.