Skip to content

Commit

Permalink
add channel support 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Novak committed Mar 5, 2024
1 parent 6011102 commit 44fd3b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ fn handle_fanout_ws(mut req: Request, chan: &str) -> Response {
resp
}

fn handle_fanout(req: Request) -> Response {
let chan = req.get_header_str("FANOUT").unwrap_or("test");
fn handle_fanout(req: Request, chan: &str) -> Response {
match req.get_url().path() {
"/stream/long-poll" => fanout_util::grip_response("text/plain", "response", chan),
"/stream/plain" => fanout_util::grip_response("text/plain", "stream", chan),
Expand All @@ -54,7 +53,9 @@ fn main() -> Result<(), Error> {
return Ok(if req.get_header_str("Grip-Sig").is_some() {
// Request is from Fanout

handle_fanout(req).send_to_client();
let channel = &req.get_header_str("FANOUT").unwrap_or("test");

handle_fanout(req, channel).send_to_client();
} else {
// Not from fanout, hand it off to Fanout to manage
req.with_header("Access-Control-Allow-Origin","*").handoff_fanout("self")?
Expand Down

0 comments on commit 44fd3b8

Please sign in to comment.