http://channels.readthedocs.io/en/stable/asgi/www.html#receive
438788
def get_receive_message(self, data):
        '''
        
        '''
        self.order += 1
        message = {
            'channel': 'websocket.receive',
            'reply_channel': None,
            'path': self.path,
            'order': self.order,
            'text': None,
            'bytes': None,
        }
        if isinstance(data, str):
            message['text'] = data
        elif isinstance(data, bytes):
            message['bytes'] = data
        return message
897813
public function receive()
    {
        // Set valid request sources
        $this->setRequestSources(
            $this->emitValidRequestSources(
                DOOZR_RUNTIME_ENVIRONMENT
            )
        );

        // HTTP Version of the request made
        $protocolVersion = explode('/', (isset($_SERVER['SERVER_PROTOCOL'])) ? $_SERVER['SERVER_PROTOCOL'] : '/');

        // Store protocol version
        $this->withProtocolVersion(
            (true === isset($protocolVersion[1])) ? $protocolVersion[1] : '1.0'
        );

        // Store headers normalized to prevent System/OS/PHP mismatches
        $headers = $this->normalizeHeaders(getallheaders());
        foreach ($headers as $header => $value) {
            $this->withHeader($header, $value);
        }

        // Receive and store request method (HTTP verb)
        $this->withMethod(
            $this->receiveMethod()
        );

        // Emulate the request in case of PUT ...
        $this->equalizeRequestArguments(
            $this->getMethod(),
            $headers
        );

        // Store cookies
        $this->withCookieParams(
            $_COOKIE
        );

        // Parse upload(s) in PSR-7 more/better logical structure (some array shuffling)
        $uploadedFileFactory = new Doozr_Request_File_UploadedFileFactory($_FILES);
        $uploadedFiles       = $uploadedFileFactory->build();

        $this->withUploadedFiles(
            $uploadedFiles
        );

        // Store query params as array
        $queryArguments = [];
        parse_str($_SERVER['QUERY_STRING'], $queryArguments);
        $this->withQueryParams(
            $queryArguments
        );

        // Detect if Ajax and set flag
        $this->withAttribute('isAjax', $this->isAjax());

        // Store body arguments (_POST _PUT ...) as parsed body representation
        $this->withParsedBody(
            $this->receiveArguments($this->getMethod())
        );

        // Set the request target!
        $this->withRequestTarget($this->getUri()->getPath());

        return true;
    }
920392
def recv(sock, size):
    """"""
    data = sock.recv(size, socket.MSG_WAITALL)
    if len(data) < size:
        raise socket.error(ECONNRESET, 'Connection closed')
    return data
569128
def receive(self, msg):
        '''
        
        '''
        handler = getattr(self, 'receive_' + msg.__class__.__name__.lower(), None)
        if handler is None:
            raise InvalidMessageError('Receiving class does not support messages of type: ' + msg.__class__.__name__)
        return handler(msg)
498461
def receive(self):
        
        try:
            itr = 0
            while self.connected:
                
                r, w, e = select.select(
                    (self.sock, ), (), (), 10.0)
                
                if r:
                    message = json.loads(self.recv())
                    
                    if 'fetch' in message:
                        self.fetch_id = message['fetch']
                    
                    if 'failure' in message:
                        raise InvalidFetch(message['failure'])
                    
                    if 'records' in message:
                        if 'added' in message['records']:
                            num = len(message['records']['added'])
                        else:
                            num = len(message['records'])
                        
                        logger.debug('Query returned %s records.', num)
                        if self.max_recv:
                            itr += 1
                        
                    if 'end' in message:
                        logger.debug('Received end message: %s' % message['end'])
                        yield message
                        break
                    
                    yield message
                    if self.max_recv and self.max_recv <= itr:
                        break   

        except (Exception, KeyboardInterrupt, SystemExit, FetchAborted) as e:
            logger.info('Caught exception in receive: %s -> %s', type(e), str(e))
            if isinstance(e, (SystemExit, InvalidFetch)):
                # propagate SystemExit, InvalidFetch
                raise
        finally:
            if self.connected:
                if self.fetch_id:
                    self.send(json.dumps({'abort': self.fetch_id}))
                self.close()
            
            if self.thread:
                self.event.set()
                while self.thread.isAlive():
                    self.event.wait(1)
            
            logger.info('Closed web socket connection normally.')
954311
def _receive(self):
        
        data_in = EMPTY_BUFFER
        try:
            data_in = self._read_from_socket()
        except socket.timeout:
            pass
        except (IOError, OSError) as why:
            if why.args[0] not in (EWOULDBLOCK, EAGAIN):
                self._exceptions.append(AMQPConnectionError(why))
                self._running.clear()
        return data_in
1228384
def receive(self, path, diff, showProgress=True):
        
        directory = os.path.dirname(path)

        cmd = ["btrfs", "receive", "-e", directory]

        if Store.skipDryRun(logger, self.dryrun)("Command: %s", cmd):
            return None

        if not os.path.exists(directory):
            os.makedirs(directory)

        process = subprocess.Popen(
            cmd,
            stdin=subprocess.PIPE,
            stderr=subprocess.PIPE,
            stdout=DEVNULL,
        )
        _makeNice(process)

        return _Writer(process, process.stdin, path, diff, showProgress)
1012214
def tcp_receive(self):
        """"""
        data = self.conn.recv(self.BUFFER_SIZE)

        if type(data) != str:
            # Python 3 specific
            data = data.decode("utf-8")

        return str(data)
945630
def receive(self, decode=True):
        
        payload = self.socket.recv()
        payload = self.verify(payload)
        if decode:
            payload = self.decode(payload)
        return payload
204064
def recv(self, size):
        """"""
        while True:
            try:
                data = self._sock.recv(size)
                self.bytes_read += len(data)
                return data
            except socket.error as e:
                what = (
                    e.args[0] not in errors.socket_errors_nonblocking
                    and e.args[0] not in errors.socket_error_eintr
                )
                if what:
                    raise
239218
function receiveIframeMessage(event) {
  // does the origin sending the message match the current host? if not dev/null the request
  if (
    window.location.protocol !== 'file:' &&
    event.origin !== window.location.protocol + '//' + window.location.host
  ) {
    return;
  }

  let path;
  let data = {};
  try {
    data = typeof event.data !== 'string' ? event.data : JSON.parse(event.data);
  } catch (e) {
    // @todo: how do we want to handle exceptions like these?
  }

  if (data.event !== undefined && data.event === 'patternLab.updatePath') {
    if (window.patternData.patternPartial !== undefined) {
      // handle patterns and the view all page
      const re = /(patterns|snapshots)\/(.*)$/;
      path =
        window.location.protocol +
        '//' +
        window.location.host +
        window.location.pathname.replace(re, '') +
        data.path +
        '?' +
        Date.now();
      window.location.replace(path);
    } else {
      // handle the style guide
      path =
        window.location.protocol +
        '//' +
        window.location.host +
        window.location.pathname.replace(
          'styleguide/html/styleguide.html',
          ''
        ) +
        data.path +
        '?' +
        Date.now();
      window.location.replace(path);
    }
  } else if (data.event !== undefined && data.event === 'patternLab.reload') {
    // reload the location if there was a message to do so
    window.location.reload();
  }
}
598905
function receive($func=NULL,$overwrite=FALSE,$slug=TRUE) {
		$fw=Base::instance();
		$dir=$fw->UPLOADS;
		if (!is_dir($dir))
			mkdir($dir,Base::MODE,TRUE);
		if ($fw->VERB=='PUT') {
			$tmp=$fw->TEMP.$fw->SEED.'.'.$fw->hash(uniqid());
			if (!$fw->RAW)
				$fw->write($tmp,$fw->BODY);
			else {
				$src=@fopen('php://input','r');
				$dst=@fopen($tmp,'w');
				if (!$src || !$dst)
					return FALSE;
				while (!feof($src) &&
					($info=stream_get_meta_data($src)) &&
					!$info['timed_out'] && $str=fgets($src,4096))
					fputs($dst,$str,strlen($str));
				fclose($dst);
				fclose($src);
			}
			$base=basename($fw->URI);
			$file=[
				'name'=>$dir.
					($slug && preg_match('/(.+?)(\.\w+)?$/',$base,$parts)?
						(is_callable($slug)?
							$slug($base):
							($this->slug($parts[1]).
								(isset($parts[2])?$parts[2]:''))):
						$base),
				'tmp_name'=>$tmp,
				'type'=>$this->mime($base),
				'size'=>filesize($tmp)
			];
			return (!file_exists($file['name']) || $overwrite) &&
				(!$func || $fw->call($func,[$file])!==FALSE) &&
				rename($tmp,$file['name']);
		}
		$fetch=function($arr) use(&$fetch) {
			if (!is_array($arr))
				return [$arr];
			$data=[];
			foreach($arr as $k=>$sub)
				$data=array_merge($data,$fetch($sub));
			return $data;
		};
		$out=[];
		foreach ($_FILES as $name=>$item) {
			$files=[];
			foreach ($item as $k=>$mix)
				foreach ($fetch($mix) as $i=>$val)
					$files[$i][$k]=$val;
			foreach ($files as $file) {
				if (empty($file['name']))
					continue;
				$base=basename($file['name']);
				$file['name']=$dir.
					($slug && preg_match('/(.+?)(\.\w+)?$/',$base,$parts)?
						(is_callable($slug)?
							$slug($base,$name):
							($this->slug($parts[1]).
								(isset($parts[2])?$parts[2]:''))):
						$base);
				$out[$file['name']]=!$file['error'] &&
					(!file_exists($file['name']) || $overwrite) &&
					(!$func || $fw->call($func,[$file,$name])!==FALSE) &&
					move_uploaded_file($file['tmp_name'],$file['name']);
			}
		}
		return $out;
	}
222679
def receive(self, path, diffTo, diffFrom):
        
        diff = self.toObj.diff(diffTo, diffFrom)
        self._open(self.butterStore.receive(diff, [path, ]))
805197
def receive(timeout = nil, &block)
      message = nil
      Timers::Wait.for(timeout) do |_remaining|
        message = check(timeout, &block)
        break if message
      end
      return message if message
      raise TaskTimeout, "receive timeout exceeded"
    end
1296698
function(url, done) {
  var receive = function(res) {
    if (res.statusCode != 200) {
      var msg = 'Failed to load ' + url + '\n' +
        'HTTP responce status code: ' + res.statusCode
      printError(msg)
      done(new Error(msg))
    } else {
      var content = ''
      res
        .on('end', function() {
          done(null, content)
        })
        .on('readable', function() {
          var chunk = res.read()
          content += chunk.toString()
        })
    }
  }

  try {
    require(url.indexOf('https') === 0 ? 'https' : 'http').get(url, receive).on('error', done)
  } catch (e) {
    done(e)
  }
}
362294
def receive_message(sock, request_id, max_message_size=MAX_MESSAGE_SIZE):
    """"""
    # Ignore the response's request id.
    length, _, response_to, op_code = _UNPACK_HEADER(
        _receive_data_on_socket(sock, 16))
    # No request_id for exhaust cursor "getMore".
    if request_id is not None:
        if request_id != response_to:
            raise ProtocolError("Got response id %r but expected "
                                "%r" % (response_to, request_id))
    if length <= 16:
        raise ProtocolError("Message length (%r) not longer than standard "
                            "message header size (16)" % (length,))
    if length > max_message_size:
        raise ProtocolError("Message length (%r) is larger than server max "
                            "message size (%r)" % (length, max_message_size))
    if op_code == 2012:
        op_code, _, compressor_id = _UNPACK_COMPRESSION_HEADER(
            _receive_data_on_socket(sock, 9))
        data = decompress(
            _receive_data_on_socket(sock, length - 25), compressor_id)
    else:
        data = _receive_data_on_socket(sock, length - 16)

    try:
        unpack_reply = _UNPACK_REPLY[op_code]
    except KeyError:
        raise ProtocolError("Got opcode %r but expected "
                            "%r" % (op_code, _UNPACK_REPLY.keys()))
    return unpack_reply(data)
1035156
def received_message(self, m):
        """"""

        # TODO: No support for binary messages
        m = str(m)
        logger.debug("Incoming upstream WS: %s", m)
        uwsgi.websocket_send(m)
        logger.debug("Send ok")