Decode broadcast posted from xdomain and return a broadcast-like object.
@param {String} msg
@returns {object}
558588
function(msg) {
			var prefix = "spiritual-broadcast:";
			if (msg.startsWith(prefix)) {
				return JSON.parse(msg.split(prefix)[1]);
			}
		}
1321517
def unpack(cls, msg, client, server, request_id):
        
        payload_document = OrderedDict()
        flags, = _UNPACK_UINT(msg[:4])
        pos = 4
        if flags != 0 and flags != 2:
            raise ValueError('OP_MSG flag must be 0 or 2 not %r' % (flags,))

        while pos < len(msg):
            payload_type, = _UNPACK_BYTE(msg[pos:pos + 1])
            pos += 1
            payload_size, = _UNPACK_INT(msg[pos:pos + 4])
            if payload_type == 0:
                doc = bson.decode_all(msg[pos:pos + payload_size],
                                      CODEC_OPTIONS)[0]
                payload_document.update(doc)
                pos += payload_size
            elif payload_type == 1:
                section_size, = _UNPACK_INT(msg[pos:pos + 4])
                pos += 4
                identifier, pos = _get_c_string(msg, pos)
                # Section starts w/ 4-byte size prefix, identifier ends w/ nil.
                documents_len = section_size - len(identifier) - 1 - 4
                documents = bson.decode_all(msg[pos:pos + documents_len],
                                            CODEC_OPTIONS)
                payload_document[identifier] = documents
                pos += documents_len

        database = payload_document['$db']
        return OpMsg(payload_document, namespace=database, flags=flags,
                     _client=client, request_id=request_id,
                     _server=server)
760577
function receive(msg, rinfo){
    var packet = lob.decloak(msg);
    if(!packet) packet = lob.decode(msg); // accept un-encrypted discovery broadcast hints
    if(!packet) return mesh.log.info('dropping invalid packet from',rinfo,msg.toString('hex'));
    tp.pipe(false, {type:'udp4',ip:rinfo.address,port:rinfo.port}, function(pipe){
      mesh.receive(packet, pipe);
    });
  }
1120550
function (msg) {
    var self = this;
    if (! _.has(msg, 'collection')) {
      return '';
    } else if (typeof(msg.collection) === 'string') {
      if (msg.collection === '')
        throw Error("Message has empty collection!");
      return msg.collection;
    } else {
      throw Error("Message has non-string collection!");
    }
  }
30867
function formatter(msg, ctx) {
  while (msg.indexOf('%') !== -1) {
    const start = msg.indexOf('%');
    let end = msg.indexOf(' ', start);

    if (end === -1) {
      end = msg.length;
    }

    msg = msg.slice(0, start) + ctx[msg.slice(start + 1, end)] + msg.slice(end);
  }

  return msg;
}
1030044
function _wrapMessageHandler(onmessage) {
            return function(message) {
                var msgObject;

                if (!message.origin || "*" === message.origin ||  this.targetOrigin === message.origin) {
                    if (_isHandshake.call(this, message) && !this.disposed && !this.hosted && !this.ready) {
                        _onReady.call(this);
                    }
                    else {
                        try {
                            msgObject = this.deserialize(message.data);

                            if (_validateToken.call(this, msgObject)) {
                                return onmessage && onmessage(msgObject);
                            }
                        }
                        catch (ex) {
                            msgObject = message.data || message;
                            PostMessageUtilities.log("Error while trying to handle the message", "ERROR", "PostMessageChannel");
                        }

                        return msgObject || message;
                    }
                }
            };
        }
1124856
protected function decodeMessageBody(MessageInterface $msg)
    {
        // do we accept this type? (nb: this is an optional property)
        $type = $msg->getContentType();
        if ($type == '' && $this->assumedContentType != '') {
            $type = $this->assumedContentType;
        }
        if ($type == '' || !in_array($type, $this->acceptedContentTypes)) {
            throw new \RuntimeException("Can not decode message with content type: '$type'");
        }

        // then decode it
        switch ($type) {
            case 'application/json':
                $data = json_decode($msg->getBody(), true);
                if ($error = json_last_error()) {
                    throw new \UnexpectedValueException("Error decoding json payload: " . $error);
                }
                return $data;
            case 'application/x-httpd-php-source':
                /// @todo should we wrap this in try/catch, ob_start and set_error_handler, or just make sure it is never used?
                return eval ('return ' . $msg->body . ';');
            case 'vnd.php.serialized':
                return unserialize($msg->body);
            case 'text/plain':
            case 'application/octet-stream':
                return $msg->body;
            default:
                throw new \UnexpectedValueException("Serialization format unsupported: " . $type);
        }
    }
521832
def parse(msg):
        
        sender, conn_id, path, rest = msg.split(' ', 3)
        headers, rest = tnetstring.pop(rest)
        body, _ = tnetstring.pop(rest)

        if type(headers) is str:
            headers = json.loads(headers)

        return MongrelRequest(sender, conn_id, path, headers, body)
1071208
def _as_decode(self, msg):
        """"""
        return {'armed_statuses': [x for x in msg[4:12]],
                'arm_up_states': [x for x in msg[12:20]],
                'alarm_states': [x for x in msg[20:28]]}
847992
public function parseLine($msg)
    {
        if (!strncmp($msg, ':', 1)) {
            $pos    = strcspn($msg, ' ');
            $origin = (string) substr($msg, 1, $pos - 1);
            $msg    = new \Erebot\IrcTextWrapper((string) substr($msg, $pos + 1));
        } else {
            /// @FIXME the RFCs say we should assume origin = server instead.
            $origin = '';
            $msg    = new \Erebot\IrcTextWrapper($msg);
        }

        $type   = $msg[0];
        $type   = strtoupper($type);
        unset($msg[0]);

        $method = 'handle'.$type;
        $exists = method_exists($this, $method);
        // We need a backup for numeric events
        // as the method may alter the message.
        $backup = clone $msg;

        if ($exists) {
            $res = $this->$method($origin, $msg);
        }

        if (ctype_digit($type)) {
            // For numeric events, the first token is always the target.
            $target = $backup[0];
            unset($backup[0]);
            return $this->connection->dispatch(
                $this->makeEvent(
                    '!Numeric',
                    intval($type, 10),
                    $origin,
                    $target,
                    $backup
                )
            );
        }

        if ($exists) {
            return $res;
        }

        /// @TODO: logging
        return false;
    }
980240
public function parseServerFinalMessage($msg)
    {
        foreach (explode(',', $msg) as $val) {
            list($attr, $aval) = array_map('trim', explode('=', $val, 2));

            switch ($attr) {
            case 'e':
                return false;

            case 'v':
                return (base64_decode($aval) === $this->_serversig);
            }
        }

        return false;
    }
652422
function hashMessage(msg) {
  const sha1 = crypto.createHash('sha1');
  sha1.update(msg);
  return sha1.digest('hex');
}
394096
function(msg) {
				msg.addOption(new Option(Message.Option.URI_PATH, new Buffer("c")));
				msg.addOption(new Option(Message.Option.URI_QUERY, encodedCrc));
				if (includeIndex) {
					var idxBin = messages.ToBinary(chunkIndex, "uint16");
					msg.addOption(new Option(Message.Option.URI_QUERY, idxBin));
				}
				return msg;
			}
586579
public static void v(com.couchbase.lite.LogDomain domain, String msg) {
        sendToLoggers(com.couchbase.lite.LogLevel.VERBOSE, domain, msg);
    }
1036711
@POST
    @Produces("application/json")
    public String broadcast(Message message) {
        try {
            Response msg = new Response(message.author, message.message);
            AtmosphereResource r = (AtmosphereResource)req.getAttribute("org.atmosphere.cpr.AtmosphereResource");
            r.getAtmosphereConfig().getBroadcasterFactory().lookup("/cxf-chat").broadcast(mapper.writeValueAsString(msg));
        } catch (JsonProcessingException e) {
            //ignore
        }
        return "";
    }
694592
function parse(msg) {
  let model;
  if (typeof msg === 'object') {
    // data is a MessageEvent not a raw string
    msg = msg.data;
  }

  if (msg.startsWith(PullMessage.TYPE)) {
    // pull
    return new PullMessage();
  }

  if (msg.startsWith(RegisteredMessage.TYPE)) {
    // registered ack
    return new RegisteredMessage();
  }

  if (msg.startsWith(PushMessage.TYPE + '/')) {
    // push/modelStr
    model = msg.substring(PushMessage.TYPE.length + 1);
    return new PushMessage(model);
  }

  if (msg.startsWith(PushKevSMessage.TYPE + '/')) {
    // push/kevsStr
    model = msg.substring(PushKevSMessage.TYPE.length + 1);
    return new PushKevSMessage(model);
  }

  if (msg.startsWith(RegisterMessage.TYPE)) {
    // register/nodeName/modelStr
    const payload = msg.substring(RegisterMessage.TYPE.length + 1);
    let index = 0;
    let ch = payload.charAt(index);
    while (index < payload.length && ch !== '/') {
      index++;
      ch = payload[index];
    }
    const nodeName = payload.substring(0, index);
    return new RegisterMessage(nodeName, payload.substring(index + 1));
  }

  return null;
}
577019
def decode_bucket_props(self, msg):
        
        props = {}
        for prop in NORMAL_PROPS:
            if msg.HasField(prop):
                props[prop] = getattr(msg, prop)
                if isinstance(props[prop], bytes):
                    props[prop] = bytes_to_str(props[prop])
        for prop in COMMIT_HOOK_PROPS:
            if getattr(msg, 'has_' + prop):
                props[prop] = self.decode_hooklist(getattr(msg, prop))
        for prop in MODFUN_PROPS:
            if msg.HasField(prop):
                props[prop] = self.decode_modfun(getattr(msg, prop))
        for prop in QUORUM_PROPS:
            if msg.HasField(prop):
                props[prop] = self.decode_quorum(getattr(msg, prop))
        if msg.HasField('repl'):
            props['repl'] = REPL_TO_PY[msg.repl]
        return props