 <p>Make sure socket.io script is included and define sensor var for get it working as </p> <pre><code>var socket = io('http://localhost'); </code></pre> <p>And finally get sure clicked function is getting called when event is fired.</p> <p>Hope it helps!</p>