You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 2, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+31-20Lines changed: 31 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -6,37 +6,43 @@ A [socket.io](https://socket.io) plugin for Vue.js.
6
6
7
7
> **This package does not support native websockets**. At the time, we recommend using [vue-native-websocket](https://github.com/nathantsoi/vue-native-websocket) or [implementing it yourself](https://alligator.io/vuejs/vue-socketio/). For ongoing discussion on this, please visit [#2](https://github.com/icebob/vue-websocket/issues/2).
8
8
9
-
## Install
10
-
### NPM
11
-
You can install it via [NPM](http://npmjs.org/).
12
-
```
13
-
$ npm install vue-websocket
9
+
## Installation
10
+
You can either install this package with `npm`, or manually by downloading the zip file.
11
+
12
+
### npm
13
+
14
+
```bash
15
+
$ npm install -S vue-websocket
14
16
```
17
+
15
18
### Manual
16
-
Download zip package and unpack and add the `vue-websocket.js` file to your project from dist folder.
1. Download the latest zip file from [here](https://github.com/icebob/vue-websocket/archive/master.zip).
20
+
2. Unzip the file and add the `dist/vue-websocket.js` file to your project.
20
21
21
22
## Usage
22
-
Register the plugin, it will connect to `/`
23
+
Register the plugin. By default, it will connect to `/`:
24
+
23
25
```js
24
26
importVueWebsocketfrom"vue-websocket";
25
27
Vue.use(VueWebsocket);
26
28
```
27
-
or connect to other address:
29
+
30
+
Or to connect to another address:
31
+
28
32
```js
29
33
Vue.use(VueWebsocket, "ws://otherserver:8080");
30
34
```
31
-
You can pass options too:
35
+
36
+
You can also pass options:
37
+
32
38
```js
33
39
Vue.use(VueWebsocket, "ws://otherserver:8080", {
34
40
reconnection:false
35
41
});
36
42
```
37
43
44
+
To use it in your components:
38
45
39
-
Use it in your components:
40
46
```html
41
47
<script>
42
48
exportdefault {
@@ -91,25 +97,30 @@ Use it in your components:
91
97
</script>
92
98
```
93
99
94
-
## Build
95
-
This command will build a distributable version in the `dist` directory.
100
+
## Develop
101
+
102
+
### Building
103
+
This command will build a distributable version in the `dist` directory:
104
+
96
105
```bash
97
-
npm run build
106
+
$ npm run build
98
107
```
99
108
100
-
## Test
109
+
## Testing
110
+
This package uses [`karma`](https://www.npmjs.com/package/karma) for testing. You can run the tests like so:
111
+
101
112
```bash
102
-
npm test
113
+
$ npm test
103
114
```
104
115
105
116
## Contribution
106
117
Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.
107
118
108
119
## License
109
-
vue-websocket is available under the [MIT license](https://tldrlegal.com/license/mit-license).
120
+
`vue-websocket` is available under the [MIT license](https://tldrlegal.com/license/mit-license).
0 commit comments