const applyIOHelpers = ({ app, api, io, logger }) => { // Global Bodyshop Room const getBodyshopRoom = (bodyshopId) => `bodyshop-broadcast-room:${bodyshopId}`; // Messaging - conversation specific room to handle detailed messages when the user has a conversation open. const getBodyshopConversationRoom = ({ bodyshopId, conversationId }) => `bodyshop-conversation-room:${bodyshopId}:${conversationId}`; const ioHelpersAPI = { getBodyshopRoom, getBodyshopConversationRoom }; // Helper middleware app.use((req, res, next) => { req.ioHelpers = ioHelpersAPI; next(); }); return ioHelpersAPI; }; module.exports = { applyIOHelpers };