-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce messenger interface to v2.x.x
- Loading branch information
1 parent
0aff095
commit 5ef2c9e
Showing
2 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace WyriHaximus\React\ChildProcess\Messenger; | ||
|
||
use WyriHaximus\React\ChildProcess\Messenger\Messages\ActionableMessageInterface; | ||
use WyriHaximus\React\ChildProcess\Messenger\Messages\Error; | ||
use WyriHaximus\React\ChildProcess\Messenger\Messages\LineInterface; | ||
use WyriHaximus\React\ChildProcess\Messenger\Messages\Message; | ||
use WyriHaximus\React\ChildProcess\Messenger\Messages\Rpc; | ||
|
||
interface MessengerInterface | ||
{ | ||
/** | ||
* @param string $target | ||
* @param callable $listener | ||
*/ | ||
public function registerRpc($target, callable $listener); | ||
|
||
/** | ||
* @param string $target | ||
*/ | ||
public function deregisterRpc($target); | ||
|
||
/** | ||
* @param string $target | ||
* @return bool | ||
*/ | ||
public function hasRpc($target); | ||
|
||
/** | ||
* @param $target | ||
* @param $payload | ||
* @return React\Promise\PromiseInterface | ||
*/ | ||
public function callRpc($target, $payload); | ||
|
||
/** | ||
* @param Message $message | ||
*/ | ||
public function message(Message $message); | ||
|
||
/** | ||
* @param Error $error | ||
*/ | ||
public function error(Error $error); | ||
|
||
/** | ||
* @param string $uniqid | ||
* @return OutstandingCall | ||
*/ | ||
public function getOutstandingCall($uniqid); | ||
|
||
/** | ||
* @param Rpc $rpc | ||
* @return \React\Promise\Promise | ||
*/ | ||
public function rpc(Rpc $rpc); | ||
|
||
/** | ||
* @param ActionableMessageInterface $line | ||
* @return LineInterface | ||
*/ | ||
public function createLine(ActionableMessageInterface $line); | ||
|
||
/** | ||
* @return \React\Promise\Promise | ||
*/ | ||
public function softTerminate(); | ||
|
||
/** | ||
* @param string $line | ||
*/ | ||
public function write($line); | ||
} |