Skip to content

Commit c783807

Browse files
author
Jacek Pietal
committed
feat: add chat plugin
1 parent f7911e0 commit c783807

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ yarn add chef-socket
2626
yarn add chef-uws
2727
```
2828

29+
## Chat
30+
31+
```
32+
yarn add chef-(socket|uws)
33+
yarn chef-(socket|uws) folder --plugin node_modules/chef-core/chat.js
34+
```
35+
2936
## License
3037

3138
MIT

chat.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = function chat(_ws, { id, event, data }) {
2+
// broadcast to all sockets inside this topic
3+
this.to('chat').emit(event, id, data)
4+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "chef-core",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "chef-js core functionalities",
55
"main": "index.js",
66
"types": "./dist/index.d.ts",
7-
"files": ["dist"],
7+
"files": ["dist", "chat.js"],
88
"scripts": {
99
"build": "tsc",
1010
"test": "jest"

0 commit comments

Comments
 (0)