title: java to node.js code conversion
body: <p>I am using following java code to unwrap the data. But i don't know how could i write same for Node.js ? Java code is shown below:</p>
  
  <pre><code>public void receiveEvent(String forTopic, MqttMessage event)
          throws MqttException {
      Object obj = null;
      java.io.ByteArrayInputStream bstream = new   java.io.ByteArrayInputStream(
              event.getPayload());
      try {
          java.io.ObjectInputStream st = new java.io.ObjectInputStream(
                  bstream);
          obj = st.readObject();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      DataWrapper dt = (DataWrapper) obj;
   s.notifyReceived(forTopic, dt.getObject(), dt.getDevice());
  </code></pre>
  
  <p>Code for data wrapper is shown below:</p>
  
  <pre><code>public class DataWrapper implements Serializable {
  private static final long serialVersionUID = 1L;
  Device device;
  Object object;
  public void setDevice(Device deviceInfo) {
      this.device = deviceInfo;
  }
  public void setObject(Object object) {
      this.object = object;
  }
  public Device getDevice() {
      return device;
  }
  public Object getObject() {
      return object;
  }
  </code></pre>
  
  <p>}</p>