Get messages from store in chronological order

This commit is contained in:
Franck Royer 2021-05-19 11:57:03 +10:00
parent de3aea626a
commit fb7e9f2b9e
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 6 additions and 1 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Implement [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/). - Implement [Waku v2 Light Push protocol](https://rfc.vac.dev/spec/19/).
- Expose `Direction` enum from js-waku root (it was only accessible via the proto module).
## [0.4.0] - 2021-05-18 ## [0.4.0] - 2021-05-18

View File

@ -3,6 +3,7 @@ import util from 'util';
import { import {
ChatMessage, ChatMessage,
Direction,
Environment, Environment,
getStatusFleetNodes, getStatusFleetNodes,
StoreCodec, StoreCodec,
@ -80,6 +81,7 @@ export default async function startChat(): Promise<void> {
const messages = await waku.store.queryHistory({ const messages = await waku.store.queryHistory({
peerId, peerId,
contentTopics: [ChatContentTopic], contentTopics: [ChatContentTopic],
direction: Direction.FORWARD,
}); });
messages?.map((msg) => { messages?.map((msg) => {
if (msg.payload) { if (msg.payload) {

View File

@ -13,6 +13,6 @@ export {
export { WakuRelay, RelayCodec } from './lib/waku_relay'; export { WakuRelay, RelayCodec } from './lib/waku_relay';
export { WakuStore, StoreCodec } from './lib/waku_store'; export { Direction, WakuStore, StoreCodec } from './lib/waku_store';
export * as proto from './proto'; export * as proto from './proto';

View File

@ -11,6 +11,8 @@ import { Direction, HistoryRPC } from './history_rpc';
export const StoreCodec = '/vac/waku/store/2.0.0-beta3'; export const StoreCodec = '/vac/waku/store/2.0.0-beta3';
export { Direction };
export interface Options { export interface Options {
peerId: PeerId; peerId: PeerId;
contentTopics: string[]; contentTopics: string[];