diff --git a/app/assets/javascripts/editor/websocket.js b/app/assets/javascripts/editor/websocket.js index 1bc26648..09d64975 100644 --- a/app/assets/javascripts/editor/websocket.js +++ b/app/assets/javascripts/editor/websocket.js @@ -86,7 +86,11 @@ CommandSocket.prototype.executeCommand = function(cmd) { * @param data */ CommandSocket.prototype.send = function(data) { - this.websocket.send(data); + // Only send message if WebSocket is open and ready. + // Ignore all other messages (they might hit a wrong container anyway) + if (this.getReadyState() === this.websocket.OPEN) { + this.websocket.send(data); + } }; /**