Skip to content

Comments

Added new subscriber callback#6

Open
pennyandsean wants to merge 8 commits intoyehya:masterfrom
inerva:feature/subscriber-callback
Open

Added new subscriber callback#6
pennyandsean wants to merge 8 commits intoyehya:masterfrom
inerva:feature/subscriber-callback

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