Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxleiko/kevoree-wsgroup-onconnect
Kevoree example using WSGroup onConnect dictionary attribute
https://github.com/maxleiko/kevoree-wsgroup-onconnect
Last synced: 8 days ago
JSON representation
Kevoree example using WSGroup onConnect dictionary attribute
- Host: GitHub
- URL: https://github.com/maxleiko/kevoree-wsgroup-onconnect
- Owner: maxleiko
- License: lgpl-3.0
- Created: 2015-04-08T12:01:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-10T13:40:15.000Z (over 9 years ago)
- Last Synced: 2024-04-21T06:17:37.594Z (7 months ago)
- Size: 191 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Kevoree WSGroup "onConnect" example
### Architecture
This example is composed of 3 different runtimes.- **main** starts a **JavascriptNode** composed of:
- `printer: ConsolePrinter` to log incoming messages
- `broker: WSMsgBroker` to give a message broker endpoint to clients
- `sync: WSGroup` to broadcast models accross nodes and add a **Ticker** and a **WSChan** binding to each new client with `onConnect`
- **jsClient** starts a **JavascriptNode** that connects to the **WSGroup** master server
- **javaClient** starts a **JavaNode** that connects to the **WSGroup** master server### onConnect content
```kevs
add {nodeName}.ticker: Ticker
bind {nodeName}.ticker.tick chan
```
Each time a new node will connect to `sync: WSGroup`, the **KevScript** content in **onConnect** will be interpreted on the master node and send back to the newly connected node as a **new model to deploy**.- `{nodeName}` refers to the newly connected node name
- `{groupName}` refers to the current WSGroup name> So the content of **onConnect** will add a `ticker: Ticker` instance to the newly connected node, and it will bind its ticker output port to the current `main.kevs` channel instance `chan: WSChan`
### How to run it
First of all, you will need to start the `main.kevs` runtime
```sh
kevoreejs -p . -n mainNode --kevscript main.kevs
```> If you do not have **kevoreejs** available, just run:
> `npm i -g kevoree-nodejs-runtime`Then, start wheter the Javascript or the Java client (order does not matter)
```sh
# Java client
java -Dnode.name=javaClient -Dnode.bootstrap=javaClient.kevs -jar kevoree.jar
```
```sh
# JavascriptClient
kevoreejs -p . -n jsClient --kevscript jsClient.kevs
```