diff --git a/src/game-lib-socket-0.js b/src/game-lib-socket-0.js index 14c163f..1e28cca 100644 --- a/src/game-lib-socket-0.js +++ b/src/game-lib-socket-0.js @@ -37,11 +37,21 @@ GameLib.Socket = function( this.connected = false; + var linkedObjects = { + server : GameLib.Server + }; + + if (this.socketType === GameLib.API.Socket.TYPE_CAST) { + linkedObjects.source = GameLib.Component; + } + + if (this.socketType === GameLib.API.Socket.TYPE_RECEIVE) { + linkedObjects.destination = GameLib.Component; + } + GameLib.Component.call( this, - { - server : GameLib.Server - } + linkedObjects ); }; diff --git a/src/game-lib-socket-cast.js b/src/game-lib-socket-cast.js index 37ddb07..1452aaa 100644 --- a/src/game-lib-socket-cast.js +++ b/src/game-lib-socket-cast.js @@ -35,13 +35,6 @@ GameLib.Socket.Cast = function( socket, apiSocketCast ); - - GameLib.Component.call( - this, - { - source : GameLib.Component - } - ); }; GameLib.Socket.Cast.prototype = Object.create(GameLib.API.Socket.Cast.prototype); diff --git a/src/game-lib-socket-receive.js b/src/game-lib-socket-receive.js index 8904a61..d8b6b51 100644 --- a/src/game-lib-socket-receive.js +++ b/src/game-lib-socket-receive.js @@ -36,13 +36,6 @@ GameLib.Socket.Receive = function( apiSocketReceive ); - GameLib.Component.call( - this, - { - destination : GameLib.Component - } - ); - }; GameLib.Socket.Receive.prototype = Object.create(GameLib.API.Socket.Receive.prototype);