Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed46468

Browse files
author
Jacek Jan Pietal
committed
feat: further update readme (toc)
1 parent 8d15d5e commit ed46468

File tree

2 files changed

+65
-36
lines changed

2 files changed

+65
-36
lines changed

README.md

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,50 @@
77
</p>
88

99
<p align="center">
10-
A `bouncer` is a guy who works outside the night club checking did you pay for the entrance to that particular club. This is a simple but extendable multiple room manager for uWebSockets aka micro web sockets. One person (socket) may be in many clubs (topics) at the same time (from v2.18.0).
10+
A `bouncer` is a guy who works outside the night club checking did you pay for the entrance to that particular club.
11+
This library is a plug-and-play static files server + uWebSockets plugin manager with chat example and angular integration. One client (socket) may be subscribed to many topics (rooms) at the same time (since v2.18.0).
1112
</p>
1213

13-
<br/><br/>
14+
<br/>
1415

1516
## Common use cases when you might want to use this library:
1617

17-
- You're only able to spawn one process and you'd like to have an app with rooms.
18-
- At the same time spawn X number of scalable microservices that can connect as websockets.
19-
- Single process app server like a free `heroku.com` account or similar
20-
- Building a chat
21-
- Making node + javascript games
22-
23-
## 1. Installation
18+
- you want a static files server
19+
- you want to build a websocket chat
20+
- you want to build any websocket plugin
21+
- you want it on a single process
22+
- you want easy angular integration
23+
- you want easy vanilla js integration
24+
25+
----
26+
27+
<!-- TOC -->
28+
29+
1. [Common use cases when you might want to use this library:](#common-use-cases-when-you-might-want-to-use-this-library)
30+
1. [Installation](#installation)
31+
1. [Usage](#usage)
32+
- [Backend: Cli Usage](#backend-cli-usage)
33+
- [Backend: API Usage](#backend-api-usage)
34+
- [Frontend: Angular CharService](#frontend-angular-charservice)
35+
- [Frontend: Vanilla JS](#frontend-vanilla-js)
36+
1. [The Flow (!)](#the-flow-)
37+
1. [The Plugins (!)](#the-plugins-)
38+
1. [Configuration](#configuration)
39+
- [BouncerJS API](#bouncerjs-api)
40+
1. [Front End Client (socket.io-ish) extension](#front-end-client-socketio-ish-extension)
41+
1. [Example imports](#example-imports)
42+
1. [Tests](#tests)
43+
1. [Compatibility](#compatibility)
44+
- [What does that shim do?](#what-does-that-shim-do)
45+
1. [License](#license)
46+
- [MIT](#mit)
47+
1. [Author](#author)
48+
49+
<!-- /TOC -->
50+
51+
----
52+
53+
## Installation
2454

2555
It's hosted as an `npm` package so installation is of course as simple as:
2656

@@ -32,9 +62,9 @@ $ yarn add @jacekpietal/bouncer.js
3262
$ npm i @jacekpietal/bouncer.js --save
3363
```
3464

35-
## 2. Usage
65+
## Usage
3666

37-
### 2.a Backend: Cli Usage
67+
### Backend: Cli Usage
3868

3969
to start static server of folder `dist/your-app` with `chat` plugin and default options run:
4070

@@ -44,7 +74,7 @@ $ yarn bouncer.js dist/your-app
4474

4575
port defaults to `4200` if `process.env.PORT` not set
4676

47-
### 2.b Backend: API Usage
77+
### Backend: API Usage
4878

4979
serve folder with plugin (chat)
5080

@@ -71,7 +101,7 @@ serve(
71101
)
72102
```
73103

74-
### 2.c Frontend: Angular CharService
104+
### Frontend: Angular CharService
75105

76106
frontend for above backend
77107

@@ -103,7 +133,7 @@ $ mkdir -p src/types
103133
$ cp node_modules/@jacekpietal/bouncer.js/bouncer-js.d.ts src/types
104134
```
105135

106-
### 2.d Frontend: Vanilla JS
136+
### Frontend: Vanilla JS
107137

108138
```javascript
109139
// concect to server at port 4200
@@ -150,7 +180,7 @@ function sendMessage(event) {
150180
}
151181
```
152182

153-
## 3. The Flow (!)
183+
## The Flow (!)
154184

155185
STEP 1: Before Connection
156186

@@ -173,7 +203,7 @@ STEP 4: Finish Connection
173203
- client -> disconnects after some time
174204
- server -> broadcasts to all other people from the room that client left (config.leave)
175205

176-
## 4. The Plugins (!)
206+
## The Plugins (!)
177207

178208
- To handshake a plugin in bouncer you need to send from your connected client something with similar payload:
179209

@@ -187,15 +217,16 @@ STEP 4: Finish Connection
187217

188218
```javascript
189219
{
190-
id, // WebSocket id - this is automatically added
220+
id, // WebSocket id - this is
221+
matically added
191222
event, // event name as string
192223
data, // any data accompanying the event
193224
}
194225
```
195226

196227
- Read more (with types and parameters) in the [API Documentation](https://prozi.github.io/bouncer.js/api/)
197228

198-
## 5. Configuration
229+
## Configuration
199230

200231
A call to `new BouncerJs(userConfig)` creates a bouncer instance
201232

@@ -231,7 +262,7 @@ It is ready to receive any number of the following props if any as constructor p
231262
}
232263
```
233264

234-
### 5.a Instance of bouncer has the following API exposed:
265+
### BouncerJS API
235266

236267
```javascript
237268
{
@@ -250,7 +281,7 @@ It is ready to receive any number of the following props if any as constructor p
250281
}
251282
```
252283

253-
## 6. Front End Client (socket.io-ish) extension
284+
## Front End Client (socket.io-ish) extension
254285

255286
If you can use a bundler for frontend, see:
256287

@@ -269,7 +300,7 @@ to improve above frontend code yourself with it
269300
}
270301
```
271302

272-
## 7. Example imports from this library:
303+
## Example imports
273304

274305
```javascript
275306
// require static files server
@@ -306,7 +337,7 @@ const BouncerJs = require('@jacekpietal/bouncer.js')
306337
const shim = require('@jacekpietal/bouncer.js/lib/shim')
307338
```
308339

309-
## 8. Tests
340+
## Tests
310341

311342
| Test Suites: | 5 passed, 5 total |
312343
| ------------ | ------------------- |
@@ -319,18 +350,19 @@ const shim = require('@jacekpietal/bouncer.js/lib/shim')
319350
```bash
320351
# to test run:
321352

322-
$ yarn test # automatic tests in jest
353+
$ yarn test #
354+
matic tests in jest
323355
$ yarn start # manual test/example: chat
324356
```
325357

326-
## 9. Compatibility
358+
## Compatibility
327359

328360
For the few users to have somewhat of a bridge between the [socket-starter](https://github.com/Prozi/socket-starter) library that this library deprecates:
329361

330362
- see [shim.js](https://github.com/Prozi/bouncer.js/blob/master/lib/shim.js)
331363
- see [shim.spec.js](https://github.com/Prozi/bouncer.js/blob/master/lib/shim.spec.js)
332364

333-
### 9.a What does that shim do?
365+
### What does that shim do?
334366

335367
If you do `shim(plugin)` then your plugin may be in the format of:
336368

@@ -341,7 +373,7 @@ If you do `shim(plugin)` then your plugin may be in the format of:
341373
}
342374
```
343375

344-
## 10. License
376+
## License
345377

346378
[LICENSE](https://github.com/Prozi/bouncer.js/blob/master/LICENSE)
347379

@@ -351,6 +383,6 @@ If you do `shim(plugin)` then your plugin may be in the format of:
351383
- I am not responsible for any problem this free application causes :P
352384
- Have fun, please open any issues, etc.
353385

354-
## 11. Author
386+
## Author
355387

356388
- &copy; 2020-2021 Jacek Pietal

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,15 @@
4848
"@angular/core": "^11.2.9"
4949
},
5050
"keywords": [
51-
"bouncer",
52-
"rooms",
53-
"frontend",
51+
"http-server",
5452
"websockets",
55-
"chat",
5653
"uwebsockets",
57-
"socket-io",
58-
"socket-io-client",
59-
"nodejs",
60-
"jacekpietal",
6154
"uws",
62-
"sockets"
55+
"socket.io",
56+
"socket.io-client",
57+
"chat",
58+
"rooms",
59+
"nodejs"
6360
],
6461
"resolutions": {
6562
"ecstatic": "^4.1.4",

0 commit comments

Comments
 (0)