Skip to content

Commit

Permalink
update info
Browse files Browse the repository at this point in the history
  • Loading branch information
lajosbencz committed Feb 6, 2020
1 parent 4b20697 commit 0d3829e
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Since v3.0.0:
* New config options:
* ```namespace {string}```: The namespace for the plugin, default: ```wamp```
* ```auto_reestablish {boolean}```: Automatically re-registers and re-subscribes after reconnection
* ```auto_close_timeout {number}```: Will close the WS connection after amount of idle seconds
* ```auto_close_timeout {number}```: Will close the WS connection after amount of idle milliseconds
* Rudimentary TypeScript support

## Installation
Expand All @@ -31,28 +31,22 @@ Since v3.0.0:
npm install --save vue-wamp
```

## Example

```
cd node_modules/vue-wamp
npm run example
```

You will need to run two browser tabs to see the effects of example 1&2 (or more testers).
WAMP router by courtesy of https://demo.crossbar.io/ws, please obey [their rules](http://crossbar.io/docs/Demo-Instance/) .

Lately the demo router was unavailable, so i changed to config to connect to a local crossbar server instead.

## Configuration

```js
// entry.js
import VueWamp from 'vue-wamp'

Vue.use(VueWamp, {
debug: true, // Logs will be written to the console
url: 'ws://demo.crossbar.io/ws',
realm: 'realm1',

// change this in case of naming conflict
namespace: 'wamp',
// automatically re-registers and re-subscribes after reconnection (on by default)
auto_reestablish: true,
// automatically closes WS connection after amount of idle milliseconds (off by default)
auto_close_timeout: -1,
});
```

Expand Down Expand Up @@ -131,11 +125,11 @@ export default {

## Static methods

```Vue.Wamp.subscribe```, ```Vue.Wamp.publish```, ```Vue.Wamp.register```, ```Vue.Wamp.call```, ```Vue.Wamp.unsubscribe```, ```Vue.Wamp.unregister```
```Vue.$wamp.subscribe```, ```Vue.$wamp.publish```, ```Vue.$wamp.register```, ```Vue.$wamp.call```, ```Vue.$wamp.unsubscribe```, ```Vue.$wamp.unregister```

```js
// main.js
Vue.Wamp.subscribe('some-topic', function(args, kwArgs, details) {
Vue.$wamp.subscribe('some-topic', function(args, kwArgs, details) {
// context is empty
console.log(this); // = null
}, {
Expand Down Expand Up @@ -170,7 +164,7 @@ export default {
```

## Todo

* Tests
* Improve on src
* Improve on builder
* Example
* Tests
* Vuex integration
* Re-authentication

0 comments on commit 0d3829e

Please sign in to comment.