-
-
Notifications
You must be signed in to change notification settings - Fork 318
Open
Description
I have different apps that all use a shared socketcluster server for PubSub.
I want to separate each app's channel names to prevent conflicts so I can have the same channel names for different apps.
I tried to prefix the channel name with the app ID on the subscribe middleware on the server - something like app1/my-channel
, app2/my-channel
- but not luck.
I know that I can just subscribe to
app1/my-channel
channel from the client but in this case, it is not suitable for me and I want to let clients just subscribe tomy-channel
and the server handle the namespacing based on my client app.
How can I do namespace channels to achieve this or any other solution?
Here is my code that not working:
agServer.setMiddleware(
agServer.MIDDLEWARE_INBOUND,
async (middlewareStream) => {
for await (let action of middlewareStream) {
if (action.type === action.SUBSCRIBE) {
action.channel = `${appId}/${action.channel}`;
}
}
action.allow();
}
}
);
Metadata
Metadata
Assignees
Labels
No labels