-
-
Notifications
You must be signed in to change notification settings - Fork 430
server-sent events #99
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
Comments
If I understand correctly, an event-stream allows a server to push data to a client line by line, rather than in 1 body. This is currently not implemented in Crow (with the exception of static files). Furthermore it might require quite a few changes to how routes work, although such changes would be similar to how |
I have kept trying, but to no result:
I have extended "Connection":
I have tried a lot of things, without getting any results. |
I tried passing a lambda instead of the |
I found a much easier way to handle this. It seems that requests in crow store the IO Service object, which is what you need to send data between the server and the client, meaning a method could be easily created to take advantage of that and send data without relying on the Connection object. only potential hiccup would be SSL (as in OpenSSL) support, since an SSL connection also requires SSL context to function, so some form of that. I believe most people don't use SSL so I'll try to create some example code that uses the IO Service to send data before the response is completed and will update this comment. Update: res.set_header("Transfer-Encoding", "Chunked");
res.send_chunk(*req.adaptor, "6\r\nHello \r\n");
res.send_chunk(*req.adaptor, "5\r\nWorld\r\n");
res.send_chunk(*req.adaptor, "0\r\n\r\n"); There's no need for Sorry it took me almost a day to get this done, There was a problem with sending strings because of C strings. |
Thanks a lot! I'll try! |
I'm trying, but I'm having problems with the client reading the data from the server correctly. |
I am having a similar issue with receiving data as it comes in e.g. File uploads Regarding the SSL, I think when I played with it in the past, I am by far not an expert on ASIO, I had to wrap it such that the interface for ssl and non-ssl was type erased and unified. Most things only need to send/recv after the server starts up, I think. |
@beached I'm not sure this is the same issue @jsanchezfr was facing.. Could you provide more detail? Crow already has a wrapper for that abstracts plaintext and SSL adaptors. The reason I didn't include the SSL part is because |
no feature to implement, question is answered. |
Currently server-sent events does not work with Crow, as the request-response mechanism is not fully asynchronous anymore. |
I'm using crow for a lightweight webservices server and I have to implement a CZML one, which requires event-stream.
Is it already supported in any way?
The text was updated successfully, but these errors were encountered: