mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 07:50:37 +01:00
fix: add back removed socket method, added deprecation warnings, as there are no breaking changes allowed in v3.1.0
This commit is contained in:
@@ -272,3 +272,13 @@ Sockets.getCountInRoom = function (room) {
|
||||
const roomMap = Sockets.server.sockets.adapter.rooms.get(room);
|
||||
return roomMap ? roomMap.size : 0;
|
||||
};
|
||||
|
||||
Sockets.warnDeprecated = (socket, replacement) => {
|
||||
if (socket.previousEvents && socket.emit) {
|
||||
socket.emit('event:deprecated_call', {
|
||||
eventName: socket.previousEvents[socket.previousEvents.length - 1],
|
||||
replacement: replacement,
|
||||
});
|
||||
}
|
||||
winston.warn(`[deprecated]\n ${new Error('-').stack.split('\n').slice(2, 5).join('\n')}\n use ${replacement}`);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user