New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodegame-client

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodegame-client - npm Package Compare versions

Comparing version 2.0.5 to 2.1.0

2

docs/doc-filelist.js

@@ -1,1 +0,1 @@

var tree={"files":["index.browser.js","index.js"],"dirs":{"lib":{"dirs":{"core":{"files":["EventEmitter.js","Game.js","GameDB.js","GamePlot.js","GameStage.js","PushManager.js","Timer.js","GameMsgGenerator.js","NodeGameClient.js","PlayerList.js","Socket.js"]},"modules":{"files":["commands.js","connect.js","setup.js","extra.js","log.js","stepRules.js","variables.js"]},"stager":{"files":["stager_setters_getters.js","stager_stages_steps.js","Stager.js"]},"matcher":{"files":["Matcher.js"]}}},"listeners":{"files":["incoming.js","internal.js","setups.js"]}}};
var tree={"files":["index.browser.js","index.js"],"dirs":{"lib":{"dirs":{"core":{"files":["EventEmitter.js","Game.js","GameDB.js","GamePlot.js","GameStage.js","PushManager.js","Timer.js","GameMsgGenerator.js","NodeGameClient.js","PlayerList.js","Socket.js"]},"modules":{"files":["commands.js","connect.js","setup.js","extra.js","log.js","stepRules.js","variables.js"]},"stager":{"files":["stager_setters_getters.js","stager_stages_steps.js","Stager.js"]},"matcher":{"files":["Matcher.js"]},"sockets":{"files":["SocketDirect.js","SocketIo.js"]}}},"listeners":{"files":["incoming.js","internal.js","setups.js"]}}};

@@ -24,4 +24,4 @@ /**

// Auto-Generated.
node.version = '2.0.5';
node.version = '2.1.0';
})(window);

@@ -370,6 +370,2 @@ /**

*
* If additional properties (e.g. widgets) have been added to the game
* object by any of the previous game callbacks, they will not be removed.
* TODO: avoid pollution of the game object.
*
* GameStage is set to 0.0.0 and server is notified.

@@ -379,7 +375,8 @@ */

var node;
node = this.node;
if (!this.isStoppable()) {
throw new Error('Game.stop: game cannot be stopped.');
}
node = this.node;
// Destroy currently running timers.

@@ -393,9 +390,9 @@ node.timer.destroyAllTimers(true);

node.socket.eraseBuffer();
// Clear memory.
this.memory.clear(true);
this.memory.clear();
// If a _GameWindow_ object is found, clears it.
if (node.window) {
node.window.reset();
}
if (node.window) node.window.reset();

@@ -408,3 +405,3 @@ // Update state/stage levels and game stage.

// Temporary change:
// TODO: check if we need pl and ml again.
node.game = null;

@@ -411,0 +408,0 @@ node.game = new Game(node);

@@ -263,16 +263,12 @@ /**

/**
* ### PlayerList.clear
*
* Clears the PlayerList and rebuilds the indexes
*
* @param {boolean} confirm Must be TRUE to actually clear the list
*
* @return {boolean} TRUE, if a player with the specified id is found
*/
PlayerList.prototype.clear = function(confirm) {
NDDB.prototype.clear.call(this, confirm);
// TODO: check do we need this?
this.rebuildIndexes();
};
/**
* ### PlayerList.clear
*
* Clears the PlayerList and rebuilds the indexes
*/
PlayerList.prototype.clear = function() {
NDDB.prototype.clear.call(this);
// We need this to recreate the (empty) indexes.
this.rebuildIndexes();
};

@@ -279,0 +275,0 @@ /**

@@ -99,2 +99,24 @@ /**

/**
* ### Socket.connectingTimeout
*
* Timeout to cancel the connecting procedure
*
* @see Socket.connecting
* @see Socket.connect
*/
this.connectingTimeout = null;
/**
* ### Socket.connectingTimeoutMs
*
* Number of milliseconds for the connecting timeout
*
* Default: 10000 (10 seconds)
*
* @see Socket.connecting
* @see Socket.connect
*/
this.connectingTimeoutMs = 10000;
/**

@@ -180,2 +202,10 @@ * ### Socket.url

options = J.clone(options);
if (options.connectingTimeout) {
if (!J.isInt(options.connectingTimeout, 0)) {
throw new TypeError('Socket.setup: options.connectingTimeout ' +
'a positive number or undefined.');
}
this.connectingTimeoutMs = options.connectingTimeout;
}
if (options.type) {

@@ -236,3 +266,3 @@ this.setSocketType(options.type, options);

Socket.prototype.connect = function(uri, options) {
var humanReadableUri;
var humanReadableUri, that;

@@ -270,2 +300,14 @@ if (this.isConnected()) {

this.socket.connect(uri, this.userOptions);
// Socket Direct might be already connected.
if (this.connected) return;
that = this;
this.connectingTimeout = setTimeout(function() {
that.node.warn('connection attempt to ' + humanReadableUri +
' timed out. Disconnected.');
// False makes sure that SocketDirect will not call onDisconnect.
that.socket.disconnect(false);
that.connecting = false;
}, this.connectingTimeoutMs);
};

@@ -293,12 +335,18 @@

* Calls the disconnect method on the actual socket object
*
* @param {boolean} force Forces to call the underlying
* `socket.disconnect` method even if socket appears not connected
* nor connecting at the moment.
*/
Socket.prototype.disconnect = function(force) {
if (!force && !this.connecting && !this.connected) {
node.warn('Socket.disconnect: socket is not connected.');
if (!force && (!this.connecting && !this.connected)) {
node.warn('Socket.disconnect: socket is not connected nor ' +
'connecting. Try with force parameter.');
return;
}
this.socket.disconnect();
this.connecting = false;
this.connected = false;
};
/**

@@ -314,2 +362,3 @@ * ### Socket.onConnect

this.connecting = false;
if (this.connectingTimeout) clearTimeout(this.connectingTimeout);
this.node.emit('SOCKET_CONNECT');

@@ -334,2 +383,3 @@

this.node.emit('SOCKET_DISCONNECT');
// Save the current stage of the game

@@ -339,4 +389,4 @@ //this.node.session.store();

// On re-connection will receive a new ones.
this.node.game.pl.clear(true);
this.node.game.ml.clear(true);
this.node.game.pl.clear();
this.node.game.ml.clear();

@@ -418,4 +468,15 @@ // Restore original message handler.

if (msg.target === 'HI') {
// TODO: do we need to more checkings, besides is HI?
// Check if connection was authorized.
if (msg.to === parent.constants.UNAUTH_PLAYER) {
this.node.warn('connection was not authorized.');
if (msg.text === 'redirect') {
window.location = msg.data;
}
else {
this.disconnect();
}
return;
}
// Replace itself: will change onMessage to onMessageFull.

@@ -567,3 +628,4 @@ this.setMsgListener();

* @param {GameMsg} msg A game-msg
* @return {boolean} TRUE, if session was correctly initialized
* @param {boolean} force If TRUE, a new session will be created even
* if an existing one is found.
*

@@ -574,4 +636,11 @@ * @see node.createPlayer

*/
Socket.prototype.startSession = function(msg) {
Socket.prototype.startSession = function(msg, force) {
if (this.session && !force) {
throw new Error('Socket.startSession: session already existing. ' +
'Use force parameter to overwrite it.');
}
this.session = msg.session;
// We need to first set the session, and then eventually to stop
// an ongoing game.
if (this.node.game.isStoppable()) this.node.game.stop();
this.node.createPlayer(msg.data);

@@ -578,0 +647,0 @@ // msg.text can be undefined if channel is the "mainChannel."

@@ -64,5 +64,3 @@ /**

if (socket) {
this.socket = socket;
}
if (socket) this.socket = socket;

@@ -110,6 +108,11 @@ if (!this.socket) {

* Triggers the disconnection from the server
*
* @param {boolean} If FALSE, Socket.onDisconnect will not be called.
* Default: undefined.
*
* @see Socket.onDisconnect
*/
SocketDirect.prototype.disconnect = function() {
SocketDirect.prototype.disconnect = function(notifySocket) {
this.connected = false;
this.node.socket.onDisconnect();
if (notifySocket !== false) this.node.socket.onDisconnect();
};

@@ -116,0 +119,0 @@

{
"name": "nodegame-client"
, "description": "nodeGame client for the browser and node.js"
, "version": "2.0.5"
, "version": "2.1.0"
, "homepage": "http://www.nodegame.org"

@@ -6,0 +6,0 @@ , "keywords": ["game", "multiplayer", "experiment", "behavioral", "socket.io", "websockets"]

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc