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

KTOR-6808 Fix exception handling in SSE #4097

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marychatte
Copy link
Member

@marychatte marychatte commented Jun 24, 2024

Subsystem
Client, SSE

Motivation
KTOR-6808

@marychatte marychatte self-assigned this Jun 24, 2024
@marychatte marychatte requested a review from e5l June 24, 2024 21:02
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please fix the PR description?

@@ -98,25 +103,32 @@ private suspend fun ApplicationCall.respondSseEvents(events: Flow<SseEvent>) {

private suspend fun ByteWriteChannel.writeSseEvents(events: Flow<SseEvent>): Unit = events.collect { event ->
if (event.id != null) {
writeStringUtf8("id: ${event.id}\n")
writeStringUtf8WithNewlineAndFlush("id: ${event.id}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you tell me why do we need to flush after every write?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants