Skip to content

Commit

Permalink
updated readme with install instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcsello committed Sep 17, 2023
1 parent cc5be90 commit acc1158
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,39 @@ When the connection is closed it prints the connection details and how long were

By using these metrics, you can determine if it's possible to use long polling in a given environment.

## Compile/install

The simplest way to use this program is (if you have go installed) is just to use the following command:
```
$ go install github.com/marcsello/longPollTester@latest
```

After that's complete you can use the `longPollTester` command from the commandline:

```
$ longPollTester
2023/09/17 21:59:43 Starting HTTP server on :8080
```

If you don't have go installed, check out the Releases page, I have uploaded a pre-compiled binary version there.

## Usage

Currently two command line options supported. Use -help to get more info:
```
$ longPollTester -help
Usage of longPollTester:
-bind string
Address string to bind the server to (default ":8080")
Address string to bind the server to (default ":8080")
-timeout duration
Time for the server to return with 204 after, don't set it to never return (for intermediate timeout tests)
Time for the server to return with 204 after, don't set it to never return (for intermediate timeout tests)
```

When you start the server, it binds to `:8080` port by default. It accepts any URL and any method. Any new connections will be printed to the console.
When a client connects a log line will be printed to stdout, and another one when the client disconnects. All requests given a unique (incremental) id, it is printed at the beginning of each log line between square brackets.

```
$ go run main.go -timeout=60s
$ longPollTester -timeout=60s
2023/09/17 21:54:17 Starting HTTP server on :8080
2023/09/17 21:54:30 [1] New GET request from [::1]:40242 to /test
2023/09/17 21:55:00 [1] Connection closed! Reason: context canceled. Was open for 30.000760339s
Expand Down

0 comments on commit acc1158

Please sign in to comment.