Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob authored Nov 11, 2016
1 parent 1543f15 commit e9e28ff
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# vue-websocket
Websocket handler for VueJS. Support namespaces.

## Usage
Register the plugin
```js
import VueWebsocket from "vue-websocket";
Vue.use(VueWebsocket);
```

Use it in your components:
```html
<script>
export default {
methods: {
// Emit the server side
this.$socket.emit("add", { a: 5 });
},
socket: {
// prefix: "/counter/",
// namespace: "/counter",
events: {
// Similar as this.$socket.on("changed", (msg) => { ... });
changed(msg) {
console.log("Something changed: " + msg);
}
}
}
};
</script>
```

0 comments on commit e9e28ff

Please sign in to comment.