kuzzle icon indicating copy to clipboard operation
kuzzle copied to clipboard

As a plugin developer, I'd like to use (un)subscribe in a controller action

Open berthieresteban opened this issue 4 years ago • 0 comments

Allow plugin developers to create controller actions that subscribe the user to a realtime subscription.

We could pass the Request Context to the context.sdk.as method, so the hotel clerk will be able to register a new subscription for the connection.

The exposed subscribe method should be different from the original one because it won't accept a callback anymore. Actually the subscribe method should not use the original SDK method but rather make a direct call to Kuzzle API.

The context.sdk.as() method should accept both User and Context object to not introduce breaking change.

{{}}

context.sdk.as(request.context).subscribe('index', 'collection', filters); context.sdk.as(request.context).unsubscribe('index', 'collection', filters);

context.sdk.subscribe('index', 'collection', filters); // throw error

ttps://trello.com/c/VNtKDy5q/169-seb-autoriser-les-plugins-%C3%A0-faire-sdkasuserrealtimeunsubscribe

berthieresteban avatar Jun 18 '20 11:06 berthieresteban