title: Sending objects on websockets
body: <p>I define an object like this: </p>
  
  <pre><code>function Receipt (stat, pr) {
      var status = stat,
          price = pr;
      this.somefunction = function (someArgs) {
          // do something
      }            
  }
  </code></pre>
  
  <p>And then I have a websocket and send this object;
  The websocket is connected to a server which then relays the message to all other clients.</p>
  
  <pre><code>var rec = new Receipt('NEW', 10);
  socket.send({obj: rec});
  </code></pre>
  
  <p>The problem is this: when I receive the data on the other client(s), I receive empty objects. Is there a way to serialise the data and send it so that I can duplicate the object on the other clients – so that the definition of the object remains the same? I've tried <code>JSON.stringify</code> which hasn't helped, it just gives me <code>"{}"</code></p>