-
Notifications
You must be signed in to change notification settings - Fork 816
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: websocket for health #1256
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
_app_handle: tauri::AppHandle, | ||
tx: broadcast::Sender<crate::health::HealthCheckResponse>, | ||
) -> Result<(), Box<dyn std::error::Error>> { | ||
let addr = "127.0.0.1:9001"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be risky port, maybe 14346? or can it be same port than the tauri server? not sure if it conflict with normal http server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw why not using axum like we do already?
https://github.com/tokio-rs/axum/blob/main/examples/websockets/src/main.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
screenpipe/screenpipe-server/src/server.rs
Line 1880 in 9311d63
async fn handle_socket(socket: WebSocket, query: Query<EventsQuery>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm actually i have second thought
what about we do this health event on our existing event websocket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that'd be more easy!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about we do this health event on our existing event websocket?
screenpipe/screenpipe-server/src/server.rs
Line 1880 in 9311d63
async fn handle_socket(socket: WebSocket, query: Query<EventsQuery>) { |
i tried to implement it but the problem is when screenpipe backend goes down the websocket server goes down too, cz the ws server is from backend,
screenpipe/screenpipe-server/src/server.rs
Line 1980 in 9311d63
.route("/ws/events", get(ws_events_handler)) |
after that its not possible to emit the health error which is something like this
let error_health = HealthCheckResponse {
status: "error".to_string(),
last_frame_timestamp: None,
last_audio_timestamp: None,
last_ui_timestamp: None,
frame_status: "error".to_string(),
audio_status: "error".to_string(),
ui_status: "error".to_string(),
message: format!("health check failed: {}", e),
status_code: 500,
verbose_instructions: None,
};
one possible solution it'd be emit the error health before doing the shutdown, but it can create problem with react states!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess the hook would just show error when ws
is disconnected
@louis030195 |
i meant as custom event https://github.com/mediar-ai/screenpipe/blob/main/screenpipe-events/src/events_manager.rs |
yes, I tried it but I'm facing problems to getting values of error health |
@louis030195 |
any second thought? |
feat: #1218 (comment)
maybe we have to update all the instance of
fetchHealth
&debouncedFetchHealth
in all react components,anyway i still kept these functions in health hook even tho they aren't necessary now