Send message to the websocket.


@param array $data

@return $this|Client
498636
protected function send($data, $opcode = WebsocketPayload::OPCODE_TEXT, $masked = true)
    {
        $rawMessage = json_encode($data);
        $payload = new WebsocketPayload();
        $payload
            ->setOpcode($opcode)
            ->setMask($masked)
            ->setPayload($rawMessage);

        $encoded = $payload->encodePayload();

        if (0 === @fwrite($this->socket, $encoded)) { //connection reseted by peers, just reconnect.
            $this->connected = false;
            $this->connect($this->target);

            fwrite($this->socket, $encoded);
        }

        return $this;
    }
134144
public function setData(array $data)
    {
        parent::setData($data);

        if (isset($data['condition'])) {
            $this->setCondition($data['condition']);
        }

        return $this;
    }
594328
public function sendData($data)
    {
        $httpResponse = $this->httpClient->post(
            $this->getEndpoint(),
            ['Content-Type' => 'text/xml; charset=utf-8'],
            $this->xmlSerialize($data)
        )->send();

        return $this->response = $this->newResponse( $httpResponse->xml() );
    }
1174552
protected function send($data)
    {
        try {
            $result = $this->client->send($data);

            if ($result === false) {
                $errorCode = $this->client->errCode;

                throw new TransportException('Send data failed, cause: '.socket_strerror($errorCode).'.',
                    TransportException::CONNECTION);
            }
        }  catch (TransportException $e) {
            throw $e;
        } catch (Throwable $e) {
            if ($this->causedByConnectionProblem($e)) {
                throw new TransportException($e->getMessage(), TransportException::CONNECTION, $e);
            }

            throw new TransportException($e->getMessage(), 0, $e);
        }

        return $result;
    }
1216289
public function fromArray($data)
    {
        if (empty($data)) {
            return $this;
        }
        if (isset($data['type']) && $data['type']) {
            $this->setType($data['type']);
        }
        if (isset($data[$this->getType()]) && $data[$this->getType()]) {
            $this->setValue($data[$this->getType()]);
        }
        return $this;
    }
901371
public function setData(array $data)
    {
        $this->isMergingWidgetData = true;

        $data = $this->setCoreData($data);

        parent::setData($data);

        // Keep the data in copy, this will be passed to the property and/or input later
        $this->setPropertyData($data);

        $this->isMergingWidgetData = false;

        return $this;
    }
381414
public function sendRequest($data)
    {
        return $this->httpClient->request(
            $this->getHttpMethod(),
            $this->getEndpoint(),
            [
                'Accept' => 'application/json',
                'Authorization' => $this->getServiceKey(),
                'Content-Type' => 'application/json',
            ],
            json_encode($data)
        );
    }
1160166
public function from($data)
    {
        if (is_string($data)) {
            $this->message->mergeFromString($data);
        } elseif (!empty($data)) {
            $this->set(Arr::convert($data));
        }

        return $this;
    }
297526
public function setArray(array $data)
    {
        foreach ($data as $name => $value) {
            $this->set($name, $value);
        }
        return $this;
    }
1135805
private function sendCreateRequest($data) {
		switch($this->getMayor()) {
			case 1:
				return $this->getSoapClient()->CreateShipmentDD($data);
			case 2:
			default:
				return $this->getSoapClient()->createShipmentOrder($data);
		}
	}
579183
public function exchangeArray(array $data)
    {
        foreach ($this->object as $key => $value) {
            if (array_key_exists($key, $data)) {
                $setter = $this->getSetter($key);
                $this->$setter($data[$key]);
            }
        }

        return $this;
    }
100381
public function send(array $data)
    {
        $url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }
1036680
public function setData(array $data)
    {
        foreach ($data as $key => $val) {
            $setter = $this->setter($key);
            if (is_callable([ $this, $setter ])) {
                $this->{$setter}($val);
            } else {
                $this->{$key} = $val;
            }
        }

        return $this;
    }
1288732
public function setData(array $data) {
		$this->data = $data;

		$this->resetFields();

		foreach($data as $name=>$data)
			$this->newField($name, $data);

		$this->updateChilds();

		return $this;
	}
366333
public function setData(array $data): self
    {
        $this->data = \array_merge($this->data, $data);

        return $this;
    }
1175638
public function sendData($data)
    {
        $data = parent::sendData($data);

        return $this->response = new AopTransferToAccountResponse($this, $data);
    }
1212622
public function sendData($data)
    {
        $data = parent::sendData($data);

        return $this->response = new AopTradeCancelResponse($this, $data);
    }