Skip to content

Commit

Permalink
Merge branch 'feature/integration-2.0' of https://github.com/ably/abl…
Browse files Browse the repository at this point in the history
…y-dotnet into feature/integration-2.0
  • Loading branch information
sacOO7 committed Sep 25, 2023
2 parents 9386789 + e212777 commit 5507611
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,21 @@ if (result.IsFailure)
}
```

- When calling `channel.Publish` with a dotnet object instance as the message data, the library will use the Newtonsoft Json.NET library to serialize the message with default serialization settings.
- If you need to use custom seralization settings, you can apply the serialization yourself and send the resulting string as the message data:

```csharp
var serializedData = JsonConvert.SerializeObject(message,
new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
});

var ablyMessage = new Message("name", serializedData) {Encoding = "json"};

channel.Publish(ablyMessage);
```

### Getting channel history

Calling history returns a paginated list of message. The object is of type `PaginatedResult<Message>` and can be iterated through as a normal list.
Expand Down Expand Up @@ -331,6 +346,22 @@ catch(AblyException ablyError)
}
```

- When calling `channel.PublishAsync` with a dotnet object instance as the message data, the library will use the Newtonsoft Json.NET library to serialize the message with default serialization settings.
- If you need to use custom seralization settings, you can apply the serialization yourself and send the resulting string as the message data:

```csharp
var serializedData = JsonConvert.SerializeObject(message,
new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
});

var ablyMessage = new Message("name", serializedData) {Encoding = "json"};

channel.Publish(ablyMessage);
```


### Querying channel history

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,6 @@ public async Task WhenDisconnectedMessageContainsTokenError_IfTokenIsNotRenewabl
[Trait("spec", "RTN15h2")]
public async Task WhenDisconnectedMessageContainsTokenError_IfTokenIsRenewable_ShouldNotEmitError(Protocol protocol)
{
var awaiter = new TaskCompletionAwaiter();
var authClient = await GetRestClient(protocol);
var tokenDetails = await authClient.AblyAuth.RequestTokenAsync(new TokenParams { ClientId = "123", Ttl = TimeSpan.FromSeconds(2) });

Expand All @@ -880,6 +879,7 @@ public async Task WhenDisconnectedMessageContainsTokenError_IfTokenIsRenewable_S

await client.WaitForState(ConnectionState.Connected);

var awaiter = new TaskCompletionAwaiter();
var stateChanges = new List<ConnectionStateChange>();
client.Connection.On(state =>
{
Expand Down

0 comments on commit 5507611

Please sign in to comment.