Skip to content

Commit

Permalink
Fix null on socket connection
Browse files Browse the repository at this point in the history
  • Loading branch information
GianniCarlo committed Nov 29, 2016
1 parent 63cdc91 commit b3b7c4e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
16 changes: 12 additions & 4 deletions dist/monkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,12 @@ return /******/ (function(modules) { // webpackBootstrap
this._sendCommand(this.enums.ProtocolCommand.MESSAGE, args);

watchdog.messageInTransit(function () {
this.socketConnection.onclose = function () {};
this.socketConnection.close();
if (this.socketConnection != null) {
this.socketConnection.onclose = function () {};
this.socketConnection.close();
this.socketConnection = null;
}

setTimeout(function () {
this.startConnection();
}.bind(this), 5000);
Expand Down Expand Up @@ -950,8 +954,12 @@ return /******/ (function(modules) { // webpackBootstrap
//set watchdog
if (arrayMessages.length > 0) {
watchdog.messageInTransit(function () {
this.socketConnection.onclose = function () {};
this.socketConnection.close();
if (this.socketConnection != null) {
this.socketConnection.onclose = function () {};
this.socketConnection.close();
this.socketConnection = null;
}

setTimeout(function () {
this.startConnection();
}.bind(this), 5000);
Expand Down
16 changes: 12 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,12 @@ require('es6-promise').polyfill();
this._sendCommand(this.enums.ProtocolCommand.MESSAGE, args);

watchdog.messageInTransit(function(){
this.socketConnection.onclose = function(){};
this.socketConnection.close();
if (this.socketConnection != null){
this.socketConnection.onclose = function(){};
this.socketConnection.close();
this.socketConnection = null;
}

setTimeout(function(){
this.startConnection()
}.bind(this), 5000);
Expand Down Expand Up @@ -884,8 +888,12 @@ require('es6-promise').polyfill();
//set watchdog
if (arrayMessages.length > 0) {
watchdog.messageInTransit(function(){
this.socketConnection.onclose = function(){};
this.socketConnection.close();
if (this.socketConnection != null) {
this.socketConnection.onclose = function(){};
this.socketConnection.close();
this.socketConnection = null;
}

setTimeout(function(){
this.startConnection();
}.bind(this), 5000);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monkey-sdk",
"version": "0.8.4",
"version": "0.8.5",
"description": "Monkey SDK for web",
"main": "./dist/monkey.js",
"scripts": {
Expand Down

0 comments on commit b3b7c4e

Please sign in to comment.