title: pubnub, how to identify the sender?
body: <p>when receiving a message from pubnub, there is no information on the sender. how to know if it's a message from visitorA or visitorB ? there are examples on the web where the sender sends his name with the message, but how to know he isn't spoofing someone else's identity ?</p>
  
  <p>here is an example of a chat interface :</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;body&gt;
      &lt;form id="message_form"&gt;
        &lt;input id="message_input" type="text"/&gt;
      &lt;/form&gt;
      &lt;div id="chat"&gt;&lt;/div&gt;
      &lt;script src="http://cdn.pubnub.com/pubnub-3.7.1.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
        var pubnub = PUBNUB.init({
          publish_key: 'demo',
          subscribe_key: 'demo'
        });
  
        pubnub.subscribe({
          channel: 'chat',
          message: function(message){
            var div = document.createElement("div");
            div.textContent = message;
            var chat = document.getElementById("chat");
            chat.appendChild(div);
          }
        });
  
        var form = document.getElementById("message_form");
        form.onsubmit = function(e) {
          var input = document.getElementById("message_input");
          pubnub.publish({
            channel: 'chat',
            message: input.value
          });
          input.value = '';
          e.preventDefault();
        };
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>