Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kbariotis committed Dec 5, 2015
1 parent 1fa468f commit bb2e72f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ npm i -D wsmanager

```js
...
/* I am using `[ws](https://github.com/websockets/ws)` here */

import wsmanager from "wsmanager"

Expand All @@ -45,6 +46,43 @@ connections.forEach(function(ws){

```

## Docs

Add a client to that Account, using a function directly:
```
wsmanager.connect(account, socket)
```
* account(required): a unique identifier for an account
* socket(required): a WebSocket object

or using events:
```
wsmanager.emit('connection', {account:account, socket:socket})
```

Remove a client, using a function directly:
```
wsmanager.disconnect(account, socket)
```
* account(required): a unique identifier for an account
* socket(required): a WebSocket object

or using events:
```
wsmanager.emit('disconnection', {account:account, socket:socket})
```

Get all connections:
```
wsmanager.getConnections()
```

Get all connections by an Account:
```
wsmanager.getConnections(account)
```
* account(required): a unique identifier for an account

## License

MIT © [Kostas Bariotis](http://kostasbariotis.com)
Expand Down

0 comments on commit bb2e72f

Please sign in to comment.