Skip to content

Commit

Permalink
Updated PHP doc for batch publish
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Apr 10, 2024
1 parent 481e348 commit 7eafc1d
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,15 @@ If you're using Laravel and want to support **realtime broadcasting and events**
- It automatically adds necessary auth headers based on the initial auth config and supports pagination.
- The following is an example of using the batch publish API based on the [Ably batch publish rest endpoint documentation](https://ably.com/docs/api/rest-api#batch-publish).

```csharp
var objectPayload = new
{
channels = new[] { "channel1", "channel2", "channel3", "channel4" },
messages = new[]
{
new
{
name = "eventName",
data = "foo",
}
}
};
var jsonPayload = JsonConvert.SerializeObject(objectPayload);
var paginatedResponse = await ablyRest.RequestV2(HttpMethod.Post, "/messages", null, jsonPayload, null);
```php
$payload = array(
"channels" => ["channel1", "channel2", "channel3", "channel4"],
"messages" => array(
"id" => "1",
"data" => "foo"
)
);
$batchPublishPaginatedResult = $client->request("POST", "/messages", [], $payload);
```
- See the [ably rest endpoint doc](https://ably.com/docs/api/rest-api) for more information on other endpoints.

Expand Down

0 comments on commit 7eafc1d

Please sign in to comment.