code: function parse(msg) {
  	var pMsg;
    if (typeof msg === 'object') {
      // data is a MessageEvent not a raw string
      pMsg = msg.data;
    } else {
  		pMsg = msg;
  	}
  
    var model;
    if (startsWith(pMsg, REGISTER)) {
      var payload = pMsg.substring(REGISTER.length + SEP.length);
      var i = 0;
      var ch = payload.charAt(i);
      var buffer = '';
      while (i < payload.length && ch !== '/') {
        i++;
        buffer += ch;
        ch = payload.charAt(i);
      }
  
      if (ch !== '/') {
        buffer += ch;
      } else {
        i++;
      }
      model = null;
      if (i < payload.length) {
        model = payload.substring(i, payload.length);
      }
      return new RegisterMessage(buffer, model);
    }
  
    if (startsWith(pMsg, PUSH + SEP)) {
      model = pMsg.substring(PUSH.length + SEP.length);
      return new PushMessage(model);
    }
  
    if (startsWith(pMsg, KEVS + SEP)) {
      model = pMsg.substring(KEVS.length + SEP.length);
      return new PushKevSMessage(model);
    }
  
    if (startsWith(pMsg, PULL)) {
      return new PullMessage();
    }
  
    /* retro compat */
    if (startsWith(pMsg, 'get')) {
      return new PullMessage();
    }
  
    return null;
  }
docs: Parses message to a valid PushMessage or PullMessage type
  @param msg
  @returns {PushMessage|PullMessage|RegisterMessage}