-
-
Notifications
You must be signed in to change notification settings - Fork 412
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
Client support for server-sent events (SSE) #1317
base: master
Are you sure you want to change the base?
Client support for server-sent events (SSE) #1317
Conversation
432cbe0
to
9dd371b
Compare
Ping @haskell-servant/maintainers |
Thanks for the PR / sorry for the low bandwidth! I do not speak for all maintainers, but I think our priorities are #1312, then #1314, then release, then see what's up next, so it may take a while before this gets the attention it deserves. Is there any reason why this should go to Other maintainers: any thoughts? @vapourismo would you be open to joining us? |
Thanks for the update. I don’t need this merged right away - so no pressure. |
9dd371b
to
17ae207
Compare
I don't see anything blocking this. Why has this not moved forward? I rebased this branch against master here: https://github.com/hasufell/servant/tree/feature/server-sent-events |
Yes, ping @haskell-servant/maintainers on this. I personally don't see anything shocking. |
17ae207
to
86d0e16
Compare
Hey Ole, I am running into some trouble trying to use your great work here and would appreciate it if you can point me in the right direction. My server: I have a server running with an SSE endpoint that spits back strings of My Here's my client main function: main :: IO ()
main = do
mgr <- newTlsManager
let env = mkClientEnv mgr $ BaseUrl Http "localhost" 8000 ""
withClientM cli env $ \case
Left err -> (print err)
Right stream -> do
putStrLn "operating on stream obj"
let sourceT = unJsonEventStreamT stream
S.unSourceT sourceT go
where
go :: StepT IO (Event DummyObj) -> IO ()
go S.Stop = return ()
go (S.Error err) = do
print "error"
print err
go (S.Skip s) = do
print "skip"
go s
go (S.Effect ms) = do
print "effect"
result <- ms
go result
go (S.Yield a s) = do
putStrLn $ show "yield: " ++ show a
hFlush stdout
go s I had to modify your code a bit because it wasn't typechecking against the latest version of |
That seems to suggest that the JSON could not be parsed. You'll only get the Could it be that the |
This PR is an attempt to implement SSE for the Servant client-side.
Small example