-
Notifications
You must be signed in to change notification settings - Fork 122
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
fix: cors and sse for logs #1284
fix: cors and sse for logs #1284
Conversation
frechg
commented
Oct 16, 2024
- Updates local-interchain Docker to provide ssl certificates allowing testnet config json to be loaded remotely
- Fixes logs server CORS errors
- Fixes Server Sent Events formatting errors
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@@ -79,7 +79,7 @@ func (ls *LogStream) StreamLogs(w http.ResponseWriter, r *http.Request) { | |||
line, err := reader.ReadString('\n') | |||
if err == nil { | |||
// Send the log line to the client | |||
fmt.Fprintf(w, "%s\n", line) | |||
fmt.Fprintf(w, "data: %s\n\n", line) |
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.
assume this is for pretty parsing client side?
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.
Yeah, the data key and double new line at the end is proper server sent event format. You can get the event stream and manually handle it, but it won't work with the EventSource interface if it's not in that format. https://developer.mozilla.org/en-US/docs/Web/API/EventSource
94f22e6
into
strangelove-ventures:reece/local-ic-stream-logs