MadelineProtoDocs/docs/PHPInternal/danog/MadelineProto/Stream/RawProxyStreamInterface.md

129 lines
3.0 KiB
Markdown
Raw Normal View History

2020-10-15 18:42:54 +02:00
---
title: danog\MadelineProto\Stream\RawProxyStreamInterface: Raw stream proxy interface.
description:
---
# `danog\MadelineProto\Stream\RawProxyStreamInterface`
[Back to index](../../../index.md)
> Author: Daniil Gentili <daniil@daniil.it>
Raw stream proxy interface.
## Method list:
* `read(): \Promise Resolves with a string when new data is available or `null` if the stream has closed.`
* `write(string $data): \Promise Succeeds once the data has been successfully written to the stream.`
* `end(string $finalData): \Promise Succeeds once the data has been successfully written to the stream.`
* `connect(\danog\MadelineProto\Stream\ConnectionContext $ctx): \Generator`
* `disconnect(): void`
* `getSocket(): \Amp\Socket\EncryptableSocket`
* `setExtra(mixed $extra): void`
## Methods:
### `read(): \Promise Resolves with a string when new data is available or `null` if the stream has closed.`
Reads data from the stream.
Return value: Resolves with a string when new data is available or `null` if the stream has closed.
Fully typed return value:
```
\Promise<string|null>
```
#### See also:
* `\Promise`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `write(string $data): \Promise Succeeds once the data has been successfully written to the stream.`
Writes data to the stream.
Parameters:
* `$data`: `string` Bytes to write.
Return value: Succeeds once the data has been successfully written to the stream.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `end(string $finalData): \Promise Succeeds once the data has been successfully written to the stream.`
Marks the stream as no longer writable. Optionally writes a final data chunk before. Note that this is not the
same as forcefully closing the stream. This method waits for all pending writes to complete before closing the
stream. Socket streams implementing this interface should only close the writable side of the stream.
Parameters:
* `$finalData`: `string` Bytes to write.
Return value: Succeeds once the data has been successfully written to the stream.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `connect(\danog\MadelineProto\Stream\ConnectionContext $ctx): \Generator`
Connect to a server.
Parameters:
* `$ctx`: `\danog\MadelineProto\Stream\ConnectionContext` The connection context
#### See also:
* [`\danog\MadelineProto\Stream\ConnectionContext`: Connection context class.](./ConnectionContext.md)
* `\Generator`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `disconnect(): void`
Disconnect from the server.
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `getSocket(): \Amp\Socket\EncryptableSocket`
Get underlying AMPHP socket resource.
#### See also:
* `\Amp\Socket\EncryptableSocket`
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
### `setExtra(mixed $extra): void`
Set extra proxy data.
Parameters:
* `$extra`: `mixed` Proxy data
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)
2020-10-15 18:42:54 +02:00
2020-10-15 19:11:10 +02:00
---
Generated by [danog/phpdoc](https://phpdoc.daniil.it)