Skip to content
This repository was archived by the owner on Oct 2, 2020. It is now read-only.

Commit e9e28ff

Browse files
authored
Create README.md
1 parent 1543f15 commit e9e28ff

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# vue-websocket
2+
Websocket handler for VueJS. Support namespaces.
3+
4+
## Usage
5+
Register the plugin
6+
```js
7+
import VueWebsocket from "vue-websocket";
8+
Vue.use(VueWebsocket);
9+
```
10+
11+
Use it in your components:
12+
```html
13+
<script>
14+
export default {
15+
16+
methods: {
17+
// Emit the server side
18+
this.$socket.emit("add", { a: 5 });
19+
},
20+
21+
socket: {
22+
// prefix: "/counter/",
23+
// namespace: "/counter",
24+
25+
events: {
26+
27+
// Similar as this.$socket.on("changed", (msg) => { ... });
28+
changed(msg) {
29+
console.log("Something changed: " + msg);
30+
}
31+
32+
}
33+
}
34+
};
35+
36+
</script>
37+
```

0 commit comments

Comments
 (0)