connect example
This commit is contained in:
parent
6ea027b8c0
commit
2f73c499d3
@ -6,11 +6,10 @@
|
|||||||
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.
|
||||||
@ -27,6 +26,16 @@ Y.createPeerJsConnector({key: 'h7nlefbgavh1tt9'}, function(Connector, user_id){
|
|||||||
*/
|
*/
|
||||||
yatta = new Y.JsonYatta(user_id, Connector);
|
yatta = new Y.JsonYatta(user_id, Connector);
|
||||||
|
|
||||||
|
/**
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
// 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