I'm considering using socketcluster to build a realtime app. The docs are very clear but I could not find a way to create a channel on demand programmatically.
My need is: as a user, I would like to call a REST API which will create a channel which would immediately be up and running on the server.
For example, calling from client side: POST https://<myServer>/api/channels with JSON body { "channel": "myChannel} would create a myChannel channel on the server and my client side code would be able to subscribe directly (after having received the server response):
 var myChannel = socket.subscribe('myChannel');
 myChannel.publish('myChannel', 'I am here !');
 myChannel.watch(function (data) {
     console.log('received data from myChannel:', data);
 });
I suppose that this newly created channel would use my authorization middleware as middlewares are defined at server level (wsServer.addMiddleware(wsServer.MIDDLEWARE_SUBSCRIBE, ...)
Thanks a lot for your help,
Pierre
 
    