-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* inmem pubsub * refactor to use pubsub and channels * non-blocking view.stream * send event on websocket with fallback on http * update plugin version * subscription instead of sub * pubsub redis adapter
- Loading branch information
Showing
17 changed files
with
836 additions
and
505 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fir | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net/http" | ||
"strings" | ||
) | ||
|
||
func DefaultChannelFunc(r *http.Request, viewID string) *string { | ||
if viewID == "" { | ||
viewID = "root" | ||
if r.URL.Path != "/" { | ||
viewID = strings.Replace(r.URL.Path, "/", "_", -1) | ||
} | ||
} | ||
|
||
userID, ok := r.Context().Value(UserIDKey).(string) | ||
if !ok || userID == "" { | ||
log.Printf("warning: no user id in request context. user is anonymous\n") | ||
userID = "anonymous" | ||
} | ||
channel := fmt.Sprintf("%s:%s", userID, viewID) | ||
return &channel | ||
} |
This file contains 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
Oops, something went wrong.