diff --git a/source/js/main.js b/source/js/main.js index 332dbb1..2410bb5 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -2,10 +2,14 @@ var socket = new WebSocket('ws://localhost:8080'); var thematrix = require('./thematrix'); +var allowedMessages = ['LoadArticle', 'pageview', 'articleseen']; socket.onmessage = (e) => { - console.log(e.data); - thematrix.draw(e.data.split('|')); + var data = e.data.split('|'); + + if(allowedMessages.indexOf(data[0]) > -1) { + thematrix.draw(data); + } }; socket.onopen = () => console.log('Connected'); diff --git a/source/js/thematrix.js b/source/js/thematrix.js index 0a5c9e0..962edcf 100644 --- a/source/js/thematrix.js +++ b/source/js/thematrix.js @@ -23,7 +23,7 @@ var createCol = (text) => { col.css({ left: Math.floor(Math.random() * width), - top: Math.floor(Math.random() * height) + top: Math.floor(Math.random() * height * 0.66) }); killWhenDone(col, text.length);