Skip to content

Commit

Permalink
Update async docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jun 19, 2019
1 parent 8f25883 commit ff96248
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
18 changes: 1 addition & 17 deletions docs/docs/ASYNC.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ MadelineProto now features async, for **incredible speed improvements**, and par
Powered by [amphp](https://amphp.org), MadelineProto wraps the AMPHP APIs to provide a simpler generator-based async API.

* [Usage](#usage)
* [Loading the latest version of MadelineProto](#loading-the-latest-version-of-madelineproto)
* [Enabling the MadelineProto async API](#enabling-the-madelineproto-async-api)
* [Using the MadelineProto async API](#using-the-madelineproto-async-api)
* [Async in event handler](#async-in-event-handler)
Expand Down Expand Up @@ -62,21 +61,6 @@ This means that you can handle multiple updates, download/upload multiple files
If your code still relies on the old synchronous behaviour, don't worry, there is backward compatibility.
However, I highly recommend you switch to async, due to the huge performance and parallelism benefits.

## Loading the latest version of MadelineProto

In order to use the `yield` operator in MadelineProto, you have to load the **latest version** of MadelineProto from the **master** branch (alpha) by loading it through composer (`dev-master`) or with madeline.php:
```php
<?php

if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
define('MADELINE_BRANCH', '');
include 'madeline.php';
```

The `MADELINE_BRANCH` constant you defines which branch of MadelineProto madeline.php should load.
When the constant is not set, the `old` stable branch is loaded; if the value is an empty string, the `master` branch is loaded; otherwise, the selected branch name is loaded.
**WARNING**: MadelineProto async is not compatible with pthreads or pcntl, so please uninstall pthreads and do not use `pcntl_fork` in your bot.

## Enabling the MadelineProto async API
Expand Down Expand Up @@ -621,4 +605,4 @@ The return value of the callable can be:

If the callable does not return anything, the loop will behave is if `GenericLoop::PAUSE` was returned.

<a href="https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html">Next section</a>
<a href="https://docs.madelineproto.xyz/docs/CREATING_A_CLIENT.html">Next section</a>
5 changes: 4 additions & 1 deletion docs/docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ require_once 'madeline.php';

This code will automatically download, auto-update and include MadelineProto.

If you want, you can set a `MADELINE_BRANCH` constant that defines which branch of MadelineProto madeline.php should load.
When the constant is not set, the latest stable release is loaded; if the value is an empty string, the `master` branch is loaded; otherwise, the selected branch name is loaded.


## Simple (manual)

Expand Down Expand Up @@ -105,4 +108,4 @@ Then you can require the package by addding the following lines to the require s
"amphp/dns": "dev-master#aa1892bd as 0.9"
```

<a href="https://docs.madelineproto.xyz/docs/UPDATES.html">Next section</a>
<a href="https://docs.madelineproto.xyz/docs/UPDATES.html">Next section</a>

0 comments on commit ff96248

Please sign in to comment.