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

Asynchronoush server push #106

Closed
danesh-d opened this issue Nov 15, 2018 · 2 comments
Closed

Asynchronoush server push #106

danesh-d opened this issue Nov 15, 2018 · 2 comments

Comments

@danesh-d
Copy link

Hi,

This is rather question/feature request to whether the library supports this feature or not. I would like to know whether it is possible to push asynchronous data to the client from a HTTP server implemented using cpp-httplib? Of course by push I do not mean the push that is defined in HTTP/2 which is about pushing resources to the client in advance, but I mean pushing notification/data to the client when the client has not sent any request to the server.

A quick and naive solution in my mind would be to implement a tiny HTTP server at the client side as well, so the server can send data asynchronously using another library like curl through a PUT method to the client but I am not sure if this is an efficient solution since both server and client should have limited implementations of both server and client embedded.

Regards,

Danesh

@yhirose
Copy link
Owner

yhirose commented Nov 23, 2018

@danesh-d, sorry for the late reply. A short answer is that cpp-httplib doesn't support 'server push'.

But if we implement SSE (Server-Sent Events) support in cpp-httlib, it will be possible to push data to client. Please see this blog article.

I am not planning to implement it for now. But I'll keep this in mind. Thanks for your feedback!

@yhirose
Copy link
Owner

yhirose commented Nov 25, 2018

Since there is already an issue about SSE (#45), I'll close it.

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

No branches or pull requests

2 participants