summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js33
1 files changed, 1 insertions, 32 deletions
diff --git a/objects.js b/objects.js
index 09fd054..718d50d 100644
--- a/objects.js
+++ b/objects.js
@@ -4552,42 +4552,11 @@ StageMorph.prototype.init = function (globals) {
this.acceptsDrops = false;
this.setColor(new Color(255, 255, 255));
this.fps = this.frameRate;
-
- this.initPeering();
-};
-
-StageMorph.prototype.initPeering = function (id) {
- var myself = this;
-
- this.peer = new Peer(id, {
- host: 'snapmesh.herokuapp.com',
- port: 443,
- secure: true,
- path: '/'
- });
-
- this.peer.on('disconnected', function () {
- if (!myself.peer.destroyed && myself.peer.id) {
- myself.peer.reconnect();
- } else {
- myself.initPeering();
- }
- });
- this.peer.on('error', function (err) {
- console.log(err); // DEBUG
- });
-
- this.peer.on('connection', function (connection) {
- connection.on('open', function () {
- connection.on('data', function (data) {
- myself.newPeerMessage(data, connection.peer);
- });
- });
- });
};
StageMorph.prototype.newPeerMessage = function (data, peer) {
var ide = this.parentThatIsA(IDE_Morph);
+ if (!ide || !peer) return;
var myself = this;
var hats = [], model, message;