Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix readme #1256

Merged
merged 9 commits into from
Sep 15, 2023
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 published message is a dotnet object instance, internal newtonsoft will apply default serialization settings.
sacOO7 marked this conversation as resolved.
Show resolved Hide resolved
- If received message has unwanted serialization, publish it as a serialized string instead by applying custom serialization settings externally.
sacOO7 marked this conversation as resolved.
Show resolved Hide resolved

```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 published message is a dotnet object instance, internal newtonsoft will apply default serialization settings.
- If received message has unwanted serialization, publish it as a serialized string instead by applying custom serialization settings externally.

```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