Created
May 13, 2021 08:23
-
-
Save dkhmelenko/df436cc5dde82d59f7441850f6bbbab6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdatesController < ApplicationController | |
include ActionController::Live | |
def updates | |
response.headers["Content-Type"] = "text/event-stream" | |
sse = SSE.new(response.stream, retry: 1000, event: "time_update") | |
sse.write(Time.now) | |
ensure | |
sse.close | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment