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

Added new subscriber callback #6

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

pennyandsean
Copy link

Hey there, I hope you find this useful. We have an application that required the server to return some status information at the end of a long-poll period, say 60s. I guess normally the client would timeout, but we wanted the server to. So we created a callback for when a new client request is made. It might be a bit quick, let me know if you want it tidied up a bit or added to tests. Cheers.

@yehya
Copy link
Owner

yehya commented Feb 2, 2018

Great idea! Tests would be great as I can't push the changes without the tests. Also since we are adding callbacks I think that there should be callbacks specific to each endpoint so this could be the "GlobalCallback" that runs for all endpoints, and then another that is added when you create an endpoint, for example

longpoll.create("/hello", subscribeCallback1); 
longpoll.create("/world", subscribeCallback2); 
longpoll.setGlobalCallback(globalSubscribeCallback); // or through initial config

I'll take care of the endpoint specific callbacks.

Thanks for making a pull request!

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

Successfully merging this pull request may close these issues.

4 participants