Skip to content

Commit

Permalink
feat: add chat plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacek Pietal committed Feb 10, 2022
1 parent f7911e0 commit c783807
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ yarn add chef-socket
yarn add chef-uws
```

## Chat

```
yarn add chef-(socket|uws)
yarn chef-(socket|uws) folder --plugin node_modules/chef-core/chat.js
```

## License

MIT
4 changes: 4 additions & 0 deletions chat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function chat(_ws, { id, event, data }) {
// broadcast to all sockets inside this topic
this.to('chat').emit(event, id, data)
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "chef-core",
"version": "1.0.1",
"version": "1.0.2",
"description": "chef-js core functionalities",
"main": "index.js",
"types": "./dist/index.d.ts",
"files": ["dist"],
"files": ["dist", "chat.js"],
"scripts": {
"build": "tsc",
"test": "jest"
Expand Down

0 comments on commit c783807

Please sign in to comment.