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

Investigate subscribe() and init() in a single message #24

Closed
uklance opened this issue Jun 20, 2012 · 1 comment
Closed

Investigate subscribe() and init() in a single message #24

uklance opened this issue Jun 20, 2012 · 1 comment

Comments

@uklance
Copy link
Owner

uklance commented Jun 20, 2012

Currently push.js first sends config on the '/service/pushInit' channel before subscribing to the actual channel.

Looking at cometd-javascript\common\src\main\js\org\cometd\Cometd.js it might be possible to pass properties in the subscribe() function. If this is possible, we could remove the '/service'pushInit' and avoid possible race conditions with disconnect()

I think this cannot be done with a SubscriptionListener (since the actual message is not passed to the listener).

It might be possible to hack it with an Authorizer. http://docs.cometd.org/apidocs/org/cometd/bayeux/server/Authorizer.html

Another option is to subscribe to the '/meta/subscribe' channel.

    /**
     * Subscribes to the given channel, performing the given callback in the given scope
     * when a message for the channel arrives.
     * @param channel the channel to subscribe to
     * @param scope the scope of the callback, may be omitted
     * @param callback the callback to call when a message is sent to the channel
     * @param subscribeProps an object to be merged with the subscribe message
     * @return the subscription handle to be passed to {@link #unsubscribe(object)}
     */
    this.subscribe = function(channel, scope, callback, subscribeProps)
    {
        ...
    };
@uklance
Copy link
Owner Author

uklance commented Jun 22, 2012

Done with an authorizer

@uklance uklance closed this as completed Jun 22, 2012
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

1 participant