-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0aec286
commit 1d42ae8
Showing
5 changed files
with
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Serving TwirPHP with other services | ||
=================================== | ||
|
||
In some cases you might want to serve not just one, but multiple services from one application. | ||
The generated code contains a simple server implementation which lets you mux different services. | ||
|
||
.. code-block:: php | ||
$server = new \Twitch\Twirp\Example\Server(); | ||
// register services | ||
$server->registerServer( | ||
\Twitch\Twirp\Example\HaberdasherServer::PATH_PREFIX, | ||
new \Twitch\Twirp\Example\HaberdasherServer( | ||
new \Twirphp\Example\Haberdasher() | ||
) | ||
); | ||
Both the server and service server implement the same ``RequestHandler`` interface, so you can use the same code | ||
as in the :ref:`run-server` usage example: | ||
|
||
.. code-block:: php | ||
// ... | ||
$response = $server->handle($request); |
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
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 |
---|---|---|
|
@@ -14,3 +14,4 @@ Quickstart | |
quickstart | ||
metapackage | ||
entrypoint | ||
proto |