Skip to content

Commit

Permalink
fixed format issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoib committed Nov 26, 2024
1 parent 48edfb9 commit f2ac934
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions docs/service-layer/other-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

The retrieval of messages has the following calls:

1) Initial Sync (or Cache Miss Detection and Full Sync)
2) Periodic Retrieve (Incremental Sync)
3) User Scrolls Up - Polling (On-Demand Fetching for Older Messages)
1. Initial Sync (or Cache Miss Detection and Full Sync)
2. Periodic Retrieve (Incremental Sync)
3. User Scrolls Up - Polling (On-Demand Fetching for Older Messages)

Messages on the frontend will have a pile structure based on dates. Meaning, the frontend will keep the latest messages and will drop older ones. Call number 1 will populate this pile. This call will be called when the app is initialized or if errors are detected. Imagine this pile populates the messages view of a messaging app.

Call number 2 will bring new messages to the previously mentioned pile.
Call number 2 will bring new messages to the previously mentioned pile.

Call number 3 will bring a paginated set of messages for older conversations. The user will select a specific conversation and this call will be triggered to request older messages.
Call number 3 will bring a paginated set of messages for older conversations. The user will select a specific conversation and this call will be triggered to request older messages.

This approach aims to reduce the calls load yet providing a consistent and lightweight approach to handle messages communication between the FE and BE.
This approach aims to reduce the calls load yet providing a consistent and lightweight approach to handle messages communication between the FE and BE.

The pile will have a specific configurable cache size criteria based on amount of messages and dates (e.g., the last N messages, messages within the past X days, etc.).

Expand Down Expand Up @@ -63,20 +63,20 @@ RetrieveMessagesInitial();
}
```


### Event channel name:

```bash
RetrieveMessagesInitial
```

## Periodic Retrieve (Incremental Sync)

This event will retrieve new messages that recently came from the mediator.
This event will retrieve new messages that recently came from the mediator.

### Example input:

```javascript
RetrieveMessagesPeriodic(date="2024-11-20T00:00:00Z");
RetrieveMessagesPeriodic((date = '2024-11-20T00:00:00Z'));
```

### Example response:
Expand Down Expand Up @@ -115,10 +115,10 @@ RetrieveMessagesPeriodic(date="2024-11-20T00:00:00Z");
"status": "error",
"error": "No messages to retrieve"
}

```

### Event channel name:

```bash
RetrieveMessagesPeriodic
```
Expand All @@ -130,8 +130,11 @@ This event will retrieve old messages under user demand.
### Example input:

```javascript
RetrieveMessagesPaginated(did="did:peer:12345", date="2024-11-20T00:00:00Z", pollSize=50);

RetrieveMessagesPaginated(
(did = 'did:peer:12345'),
(date = '2024-11-20T00:00:00Z'),
(pollSize = 50),
);
```

### Example response:
Expand All @@ -150,24 +153,23 @@ RetrieveMessagesPaginated(did="did:peer:12345", date="2024-11-20T00:00:00Z", pol
{
"did": "did:peer:12345",
"contact": "Alice",
"message":"Don’t forget the bread!",
"message": "Don’t forget the bread!",
"id": 44,
"timestamp": "2024-11-19T23:50:00Z"
}
]
}

```

```json
{
"status": "error",
"error": "Conversation not found"
}

```

### Event channel name:

```bash
RetrieveMessagesPaginated
```
Expand Down

0 comments on commit f2ac934

Please sign in to comment.