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

feat(sse): implement multiplexed SSE messages #4

Merged
merged 18 commits into from
May 30, 2023
Merged

Conversation

BastiDood
Copy link
Member

This PR implements the unified interface for SSE streams. The new /api/metrics endpoint is now an SSE endpoint that streams UserMessage[] as its first message followed by individual UserMessage objects.

interface Flow {
    ty: 'flow';
    ts: Date;
    flow: number;
}

interface Leak {
    ty: 'leak';
    ts: Date;
}

interface Control {
    ty: 'control';
    ts: Date;
    shutdown: boolean;
}

export type UserMessage = Flow | Leak | Control;

@BastiDood BastiDood requested a review from jkrperson May 30, 2023 06:18
@BastiDood BastiDood merged commit b6dff06 into main May 30, 2023
@BastiDood BastiDood deleted the mux-sse-stream branch May 30, 2023 13:37
src/lib.rs Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants