send data from frontend to backend (import of data)
509217
public static void sendStream(ObjectOutputStream oos, InputStream inputStream) throws IOException {
		int b;
		while ((b = inputStream.read()) >= 0) {
			oos.write(b);
		}
		oos.flush();
	}
108961
function send(userToken, conversationId, message, data) {
  const form = new FormData()
  form.append('message', message)
  if (data != null) {
    form.append('data', data)
  }

  const headers = form.getHeaders()
  headers.sessionToken = userToken

  const options = {
    hostname: SymConfigLoader.SymConfig.agentHost,
    port: SymConfigLoader.SymConfig.agentPort,
    path: `/agent/v4/stream/${conversationId}/message/create`,
    method: 'POST',
    headers: headers,
    agent: SymConfigLoader.SymConfig.podProxy,
  }

  return request(options, 'OBOClient/oboSendMessage', form)
}
173129
function send() {
  'use strict';
  var req = new XMLHttpRequest(),
    specs = jsApiReporter.specs(),
    payload;

  if (specs.length) {
    specs.push(logs);
  }
  payload = JSON.stringify(specs);

  req.open('post', 'http://localhost:' + port + '/put', true);
  req.onload = function () {
    if (this.responseText === 'kill') {
      chrome.app.window.current().close();
    }
  };
  req.send(payload);
}
133800
def recvProxyData(self, data):
        """"""
        if self.initialized:
            self.sendData(data)
        else:
            self.queued_data.append(data)
1199373
def import_data(self, data_items):
        
        # keep counts of all actions
        record = {
            'insert': 0, 'update': 0, 'noop': 0,
            'start': utcnow(),
            'records': {
                'insert': [],
                'update': [],
                'noop': [],
            }
        }

        for json_id, data in self._prepare_imports(data_items):
            obj_id, what = self.import_item(data)
            self.json_to_db_id[json_id] = obj_id
            record['records'][what].append(obj_id)
            record[what] += 1

        # all objects are loaded, a perfect time to do inter-object resolution and other tasks
        self.postimport()

        record['end'] = utcnow()

        return {self._type: record}
732519
def send_body(self, data):
        

        if type(data) is str:
            data = data.encode()
        self.connection.writer.write(data)
        yield from self.connection.writer.drain()
147806
def import_(self, data):
        """"""
        return self.__import(json.loads(data, **self.kwargs))
393906
def send_to_websocket(self, data):
        """"""
        data = json.dumps(data)
        self.websocket.send(data)
87458
function sendMsg(type, data) {
  if (
    typeof self !== 'undefined' &&
    (typeof WorkerGlobalScope === 'undefined' ||
      !(self instanceof WorkerGlobalScope))
  ) {
    self.postMessage(
      {
        type: `webpack${type}`,
        data,
      },
      '*'
    );
  }
}
1124565
public static function Send(){
            $oThis = self::CreateInstanceIfNotExists();
            
            if(is_object($oThis->oSmarty)){
                $oThis->CreateCacheCSS();
                $oThis->CreateCacheJS();
                
                Storage::AssignSmarty($oThis->oSmarty);
                Events::Call("BeforeSendingOutput");
                
                $oThis->oSmarty->display($oThis->sTemplateFilename);
            }
            else{
                $oThis = self::CreateInstanceIfNotExists();
                $oThis->CreateCacheCSS();
                $oThis->CreateCacheJS();
                $oThis->IncludeTemplate();
                $oThis->ReplaceVars();
                $oThis->RemoveUndefinedVars();
                $oThis->CheckConditions();
                //$oThis->ClearList();
                Events::Call("BeforeSendingOutput");

                @header('HTTP/1.1 200 OK');
                @header("Content-Type: text/html; charset=" . strtoupper(Storage::Get("app.charset", "UTF-8")), true);

                try{
                    //var_dump($oThis->sBuffer); die();
                    eval('?> ' . $oThis->sBuffer);
                    die();
                }
                catch(Exception $e){
                    die($e->getMessage());
                }
            }
        }
125246
protected function send(): void
    {
        if (self::$overflowed || !self::$sendHeaders) {
            return;
        }

        if (!self::$initialized) {
            self::$initialized = true;

            self::$sendHeaders = $this->headersAccepted();
            if (!self::$sendHeaders) {
                return;
            }

            self::$json['request_uri'] = $_SERVER['REQUEST_URI'] ?? '';
        }

        $json = @json_encode(self::$json);
        $data = base64_encode(utf8_encode($json));
        if (strlen($data) > 240 * 1024) {
            self::$overflowed = true;

            $record = [
                'message' => 'Incomplete logs, chrome header size limit reached',
                'context' => [],
                'level' => Logger::WARNING,
                'level_name' => Logger::getLevelName(Logger::WARNING),
                'channel' => 'monolog',
                'datetime' => new \DateTimeImmutable(),
                'extra' => [],
            ];
            self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
            $json = @json_encode(self::$json);
            $data = base64_encode(utf8_encode($json));
        }

        if (trim($data) !== '') {
            $this->sendHeader(static::HEADER_NAME, $data);
        }
    }
241526
public Observable<Void> sendUserData(BackendUser backendUser){
        return getWebService().sendUserData(isLoggedIn(),backendUser.getOwnerId()+"",backendUser.getUserData())
               .subscribeOn(config.subscribeOn()).observeOn(config.observeOn());
    }
1233786
def all
      # render plain: I18n::Backend::ActiveRecord::Translation.to_csv
      # send_data text: I18n::Backend::ActiveRecord::Translation.to_csv
      # above results in below message in chrome:
      # Resource interpreted as Document but transferred with MIME type application/octet-stream

      translations = I18n::Backend::ActiveRecord::Translation.where(id: [1, 2, 3])
      @header_cols = ["translation-id", "key", "value", "locale"]
      @translation_fields = %i[id key value locale]
      @translations_array = []
      translations.each do |translation|
        translation_field_values = []
        @translation_fields.each do |field|
          # for each of the translation_fields
          # get its value for the current translation
          translation_field_values << (translation.send field)
          # translation[field] would work instead of "translation.send field" in most
          # cases but not for title_es and associated fields
        end
        @translations_array << translation_field_values
      end
      headers['Content-Disposition'] = "attachment; filename=\"pwb-translations.csv\""
      headers['Content-Type'] ||= 'text/csv'
      render "all.csv"
    end
560079
def register_backend(self, name, backend):
        
        if not hasattr(backend, 'send') or not callable(backend.send):
            raise ValueError('Backend %s does not have a callable "send" method.' % backend.__class__.__name__)
        else:
            self.backends[name] = backend
974707
def sendall(self, data, flags=0):
        ''''''
        count = len(data)
        while count:
            sent = self.send(data, flags)
            # This could probably be a buffer object
            data = data[sent:]
            count -= sent
607115
def _work(self, backend, package, ident='', log=True):
        
        num = self._sending_task(backend)
        if log:
            self.log(INFO, 'Starting %s backend task #%s (%s)' % 
                           (backend, num, ident))
        try:
            conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            conn.connect(backend)
            self.send(conn, package)
            result = self.recv(conn)
            self.log(DEBUG, result)
            result = self.codec.decode(result)
        except Exception as e:
            self._canceling_task(backend)
            raise
        else:
            self._closing_task(backend)
            if log:
                self.log(INFO, 'Finished %s backend task #%s (%s)' % 
                               (backend, num, ident))
        finally:
            conn.close()
        
        if result[0] == 'error':
            # We reraise errors in our own way.
            raise BackendProcessingError(*result[1:])
        else:
            return result[1]
401562
def update_frontend(self, info):
        
        headers = {'Content-Type': 'text/event-stream'}
        if info.get('when'):
            info['when'] = info['when'].isoformat()
        requests.post(self.base_url + '/publish', data=json.dumps(info), headers=headers)