- {#each missedMessages as entry, index}
- {@const color = eventColors[MessageChannelEvent.MissedMessages]}
-
-
-
-
-

-
-
-
- {entry.messageId}
-
- {#if entry.retrievalHint}
-
- {bytesToHex(entry.retrievalHint)}
-
- {/if}
-
-
-
+
+ {#if currentIdFilter.id}
+
+ ID: {currentIdFilter.id}
+
- {/each}
+ {/if}
+
+
+ {#each filteredHistory as event, index}
+
+ {#if event}
+
+
+
+

+
+
+
+
+ {event.messageId}
+
+
+
+
+
+ {/if}
+
+ {/each}
+
+
+
+
diff --git a/examples/sds-demo/src/lib/components/StateGraph.svelte b/examples/sds-demo/src/lib/components/StateGraph.svelte
deleted file mode 100644
index b31f6a1..0000000
--- a/examples/sds-demo/src/lib/components/StateGraph.svelte
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
- {#each grid as row, y}
- {#each row as item, x}
-
- {#if item !== null && y * columns + x < identicons.length}
-
- {:else}
-
- {/if}
-
- {/each}
- {/each}
-
-
-
diff --git a/examples/sds-demo/src/lib/components/StateGraphSummary.svelte b/examples/sds-demo/src/lib/components/StateGraphSummary.svelte
index 104eeee..10133fb 100644
--- a/examples/sds-demo/src/lib/components/StateGraphSummary.svelte
+++ b/examples/sds-demo/src/lib/components/StateGraphSummary.svelte
@@ -5,6 +5,7 @@
import { MessageChannelEvent } from '@waku/sds';
import { eventColors, eventNames, currentIdFilter, matchesIdFilter } from '$lib/utils/event.svelte';
import type { MessageChannelEventObject } from '$lib/sds/stream';
+ import { hash } from '$lib/utils/hash';
let { channelId = null }: { channelId: string | null } = $props();
let unsubscribe: (() => void) | null = $state(null);
@@ -14,8 +15,7 @@
return;
}
if (event.type === MessageChannelEvent.SyncSent || event.type === MessageChannelEvent.SyncReceived) {
- event
- return;
+ event.payload.messageId = hash(event.payload.messageId + event.payload.causalHistory[0].messageId)
}
console.log('updating virtual grid', event);
update_virtual_grid(event);
diff --git a/examples/sds-demo/src/lib/utils/frequency.ts b/examples/sds-demo/src/lib/utils/frequency.ts
new file mode 100644
index 0000000..2873a93
--- /dev/null
+++ b/examples/sds-demo/src/lib/utils/frequency.ts
@@ -0,0 +1,38 @@
+import { Schedule } from "effect";
+
+import { Ref } from "effect";
+
+import { Effect } from "effect";
+
+
+export function frequency() {
+ return Effect.runPromise(
+ Effect.gen(function* () {
+ const listenCondition = yield* Ref.make(false);
+ // const queue = yield* initializeQueue;
+ yield* Effect.all(
+ [
+ // setup filter
+ // subscribe(listenCondition),
+ // // send messages
+ Effect.repeat(Effect.sync(() => {}), Schedule.spaced('2000 millis')),
+ // // Effect.repeat(takeAndSend, Schedule.spaced('2000 millis')),
+ // // periodic sync
+ // Effect.repeat(sendSync, Schedule.spaced('10000 millis')),
+ // // periodically process queue
+ // Effect.repeat(processQueue, Schedule.spaced('200 millis')),
+ // // periodically sweep buffers
+ // Effect.repeat(sweep, Schedule.spaced('2000 millis')),
+ // // periodically switch off filter to miss messages
+ Effect.repeat(
+ Ref.update(listenCondition, (listening) => !listening),
+ Schedule.spaced('2000 millis')
+ )
+ ],
+ {
+ concurrency: 'unbounded'
+ }
+ );
+ })
+ );
+}
diff --git a/examples/sds-demo/src/lib/waku/lobby.svelte.ts b/examples/sds-demo/src/lib/waku/lobby.svelte.ts
index c5d2ad7..0a0d843 100644
--- a/examples/sds-demo/src/lib/waku/lobby.svelte.ts
+++ b/examples/sds-demo/src/lib/waku/lobby.svelte.ts
@@ -1,4 +1,5 @@
import { Effect, Option, pipe, Stream } from 'effect';
+import type { MatchParams } from './waku.svelte';
// Define the type for state transition events
export interface StateTransitionDetail {
@@ -22,7 +23,8 @@ export enum LobbyMessageType {
Ping = 'ping',
Request = 'request',
Accept = 'accept',
- Match = 'match'
+ Match = 'match',
+ Ongoing = 'ongoing'
}
enum LobbyEvent {
@@ -32,7 +34,8 @@ enum LobbyEvent {
GotAccept = 'got_accept',
SentAccept = 'sent_accept',
GotMatch = 'got_match',
- SentMatch = 'sent_match'
+ SentMatch = 'sent_match',
+ Ongoing = 'ongoing'
}
export type LobbyMessage = {
@@ -41,6 +44,7 @@ export type LobbyMessage = {
expiry?: Date;
from: string;
to?: string;
+ match?: MatchParams;
};
export enum PeerState {
@@ -51,25 +55,26 @@ export enum PeerState {
AcceptTo = 'accept_to',
AcceptFrom = 'accept_from',
Success = 'success',
- Failure = 'failure'
+ Failure = 'failure',
+ Ongoing = 'ongoing'
}
// Create a class that extends EventTarget for native event handling
class LobbyState extends EventTarget {
// The peer state map
peerState = $state(new Map