connect example
This commit is contained in:
parent
2f73c499d3
commit
f4fdfda9ba
@ -4,11 +4,10 @@ Here, I will give a short overview on how to enable collaborative json with the
|
|||||||
First you have to include the following libraries in your html file:
|
First you have to include the following libraries in your html file:
|
||||||
```
|
```
|
||||||
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
<script src="http://cdn.peerjs.com/0.3/peer.js"></script>
|
||||||
<script src="../../build/browser/Frameworks/TextYatta.js"></script>
|
<script src="../../build/browser/Frameworks/JsonYatta.js"></script>
|
||||||
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
<script src="../../build/browser/Connectors/PeerJsConnector.js"></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
```
|
```
|
||||||
A working widget implementation is [IwcJson.xml](./IwcJson.xml) and the js-file is [index.js](./index.js)
|
|
||||||
### Create Connector
|
### Create Connector
|
||||||
|
|
||||||
The PeerJs Framework requires an API key, or you need to set up your own PeerJs server.
|
The PeerJs Framework requires an API key, or you need to set up your own PeerJs server.
|
||||||
@ -33,6 +32,19 @@ it will be instantly shared with all the other collaborators.
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Next, you may want to connect to another peer. Therefore you have to receive his
|
||||||
|
user_id. If the other peer is connected to other peers, the PeerJsConnector
|
||||||
|
will automatically connect to them too.
|
||||||
|
|
||||||
|
Transmitting the user_id is your job.
|
||||||
|
See the [TextEditing](../TextEditing/) an example on how to do that with urls.
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
// yatta.connector.connectToPeer(peer_user_id);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Add a integer-property like this
|
Add a integer-property like this
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user