Skip to content

Commit

Permalink
Flush (#32)
Browse files Browse the repository at this point in the history
* Add flush on icc

* Change default Port to 9007
  • Loading branch information
ostcar committed Dec 7, 2021
1 parent ae2baa6 commit fec8bf1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ printed immediately.
To listen to messages, you can use this command:

```
curl -N localhot:9013/system/icc/notify?meeting_id=5
curl -N localhot:9007/system/icc/notify?meeting_id=5
```

The meeting_id query argument is optional.
Expand All @@ -97,7 +97,7 @@ Each other other line is one notify message. It has the following format:
To publish a message, you can use the following request:

```
curl localhost:9013/system/icc/notify/publish -d '{
curl localhost:9007/system/icc/notify/publish -d '{
"channel_id": "STRING_SEE_ABOVE",
"to_meeting": 5,
"to_users": [3,4],
Expand All @@ -124,7 +124,7 @@ from the autoupdate-service repo.
To listen to messages, you can use this command:

```
curl -N localhot:9013/system/icc/notify?meeting_id=5
curl -N localhot:9007/system/icc/notify?meeting_id=5
```

The meeting_id argument is required.
Expand All @@ -138,7 +138,7 @@ The returned messages have the format:
To send applause, use:

```
curl localhost:9013/system/icc/applause/send?meeting_id=1
curl localhost:9007/system/icc/applause/send?meeting_id=1
```

The argument meeting_id is required.
Expand All @@ -154,8 +154,8 @@ TODO

The Service uses the following environment variables:

* `ICC_PORT`: Lets the service listen on port 9013. The default is
`9013`.
* `ICC_PORT`: Lets the service listen on port 9007. The default is
`9007`.
* `ICC_HOST`: The device where the service starts. The default is am
empty string which starts the service on any device.
* `ICC_REDIS_HOST`: The host of the redis instance to save icc messages. The
Expand Down
3 changes: 3 additions & 0 deletions internal/notify/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func HandleReceive(mux *http.ServeMux, notify Receiver, auth icchttp.Authenticat
icchttp.Error(w, fmt.Errorf("sending channel id: %w", err))
return
}
w.(http.Flusher).Flush()

encoder := json.NewEncoder(w)

Expand All @@ -63,6 +64,8 @@ func HandleReceive(mux *http.ServeMux, notify Receiver, auth icchttp.Authenticat
icchttp.ErrorNoStatus(w, fmt.Errorf("sending message: %w", err))
return
}

w.(http.Flusher).Flush()
}
})

Expand Down
2 changes: 1 addition & 1 deletion internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func Run(ctx context.Context, environment []string, secret func(name string) (st
// defaut values.
func defaultEnv(environment []string) map[string]string {
env := map[string]string{
"ICC_PORT": "9013",
"ICC_PORT": "9007",

"ICC_REDIS_HOST": "localhost",
"ICC_REDIS_PORT": "6379",
Expand Down

0 comments on commit fec8bf1

Please sign in to comment.