Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
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,45 @@ | ||
# Broadcast sample | ||
|
||
One server broadcasting message to n client. Each client sends a message to | ||
the server. | ||
|
||
## Installation | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
## Run | ||
|
||
Start the server in a console: | ||
|
||
``` | ||
node server | ||
``` | ||
|
||
Options: | ||
- `-p <port>`, `--port <port>`: Port to listen. Default value: 3000 | ||
|
||
Start a client in a console | ||
``` | ||
node client | ||
``` | ||
|
||
Options: | ||
- `-h <host>`, `--host <host>`: Server host. Default value: localhost | ||
- `-p <port>`, `--port <port>`: Server port. Default value: 3000 | ||
- `-t <timeout>`, `--timeout <timeout>`: Timeout between message, in milliseconds. Default value: 1000 | ||
- `<message>`: Message to send. Default value: `Hello world` | ||
|
||
Examples: | ||
``` | ||
node client hi | ||
node client -p 3000 -h localhost hi | ||
node client --timeout 2000 hi | ||
``` | ||
|
||
|
||
|
||
(Thanks to [JSON5](https://github.com/aseemk/json5) by [aseemk](https://github.com/aseemk). | ||
This file is based on that project README.md). | ||
|