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

2.8 KiB

title: danog\MadelineProto\Stream\RawStreamInterface: Raw stream interface. description:

danog\MadelineProto\Stream\RawStreamInterface

Back to index

Author: Daniil Gentili daniil@daniil.it

Raw stream 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

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

Generated by danog/phpdoc

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.


Generated by danog/phpdoc

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.


Generated by danog/phpdoc

connect(\danog\MadelineProto\Stream\ConnectionContext $ctx): \Generator

Connect to a server.

Parameters:

  • $ctx: \danog\MadelineProto\Stream\ConnectionContext The connection context

See also:


Generated by danog/phpdoc

disconnect(): void

Disconnect from the server.


Generated by danog/phpdoc

getSocket(): \Amp\Socket\EncryptableSocket

Get underlying AMPHP socket resource.

See also:

  • \Amp\Socket\EncryptableSocket

Generated by danog/phpdoc


Generated by danog/phpdoc