Skip to content

Commit

Permalink
Minor adjustments on readme
Browse files Browse the repository at this point in the history
  • Loading branch information
andrebires committed Mar 29, 2022
1 parent 9301c4a commit 8c78af5
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ Building the same message in Go would be like this:
```go
msg := &lime.Message{}
msg.SetContent(&lime.JsonDocument{
"text": "Hello from Lime!",
"timestamp": "2022-03-23T00:00:00.000Z",
}).
"text": "Hello from Lime!",
"timestamp": "2022-03-23T00:00:00.000Z"}).
SetID("1").
SetToString("john")
```
Expand All @@ -236,9 +235,8 @@ domain:
}
```

Using custom MIME types enables the mapping of types from your code.
For that, these types need to implement the `Document` interface.

Using custom MIME types enables the mapping of documents with types from your code.
For this to be possible, these types need to implement the `lime.Document` interface.

```go
type Image struct {
Expand All @@ -262,8 +260,8 @@ func init() {
}
```

To send a message to john, you can use the `SendMessage` method that is implemented both by the `lime.Server`
and `lime.Client` types:
For instance, to send a message to the "john" addresss you can use the `SendMessage` method that is implemented both by
the `lime.Server` and `lime.Client` types:

```go
msg := &lime.Message{}
Expand All @@ -274,8 +272,8 @@ msg.SetContent(lime.TextDocument("Hello from Lime!")).
err := client.SendMessage(context.Background(), msg)
```

And for receiving messages, you can use a handler that can be registered during the instantiation of the client or the
server:
And for receiving messages, you can use a message handler that can be registered during the instantiation of the client
or the server:

```go
client := lime.NewClientBuilder().
Expand All @@ -294,7 +292,8 @@ client := lime.NewClientBuilder().
A notification provide information about a message to its sender.
They are sent only for messages that have the `id` value defined.

To illustrate, a node can notify to the sender that a message was received like this:
To illustrate, a node may want to notify the sender that a message was received.
It can be done like this:

```json
{
Expand All @@ -318,8 +317,8 @@ if msg.ID != "" {
}
```

Notifications can be sent by intermediates - like the server that routes the message - or by the destination of the
message itself.
Notifications can be sent by the **destination of the message or by intermediates** - like a server that routes the
message.

The protocol define the following notification events:
- **accepted**: The message was received and accepted by an intermediate.
Expand Down Expand Up @@ -500,8 +499,7 @@ In Lime, the **client can receive and process commands requests** from other nod

### Session

> The session establishment flow is automatically handled by the library.
> This section is for informative purposes only.
> Note: The session establishment flow is automatically handled by the library.
The session envelope is used for the negotiation, authentication and establishment of the communication channel between
the client and a server.
Expand Down

0 comments on commit 8c78af5

Please sign in to comment.