mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
disable stuff that crashes in socket.io 1.x
This commit is contained in:
@@ -159,7 +159,7 @@ var opts = {
|
|||||||
/*
|
/*
|
||||||
* Restore all hijacked sockets to their original emit/on functions
|
* Restore all hijacked sockets to their original emit/on functions
|
||||||
*/
|
*/
|
||||||
var clients = socket.io.sockets.clients();
|
var clients = []; //socket.io.sockets.clients(); doesn't work in socket.io 1.x
|
||||||
clients.forEach(function(client) {
|
clients.forEach(function(client) {
|
||||||
if(client.oEmit && client.oEmit !== client.emit) {
|
if(client.oEmit && client.oEmit !== client.emit) {
|
||||||
client.emit = client.oEmit;
|
client.emit = client.oEmit;
|
||||||
@@ -179,7 +179,7 @@ var opts = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var clients = socket.io.sockets.clients();
|
var clients = []; //socket.io.sockets.clients(); doesn't work in socket.io 1.x
|
||||||
|
|
||||||
clients.forEach(function(client) {
|
clients.forEach(function(client) {
|
||||||
Logger.io_one(client, client.uid);
|
Logger.io_one(client, client.uid);
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ Sockets.uidInRoom = function(uid, room) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Sockets.getSocketCount = function() {
|
Sockets.getSocketCount = function() {
|
||||||
return false;
|
return 0;
|
||||||
|
|
||||||
var clients = io.sockets.manager.rooms[''];
|
var clients = io.sockets.manager.rooms[''];
|
||||||
return Array.isArray(clients) ? clients.length : 0;
|
return Array.isArray(clients) ? clients.length : 0;
|
||||||
|
|||||||
@@ -86,8 +86,9 @@ SocketMeta.rooms.enter = function(socket, data, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SocketMeta.rooms.getAll = function(socket, data, callback) {
|
SocketMeta.rooms.getAll = function(socket, data, callback) {
|
||||||
var rooms = websockets.server.sockets.manager.rooms,
|
var rooms = {}; //websockets.server.sockets.manager.rooms; doesnt work in socket.io 1.x
|
||||||
socketData = {
|
|
||||||
|
var socketData = {
|
||||||
onlineGuestCount: websockets.getOnlineAnonCount(),
|
onlineGuestCount: websockets.getOnlineAnonCount(),
|
||||||
onlineRegisteredCount: websockets.getOnlineUserCount(),
|
onlineRegisteredCount: websockets.getOnlineUserCount(),
|
||||||
socketCount: websockets.getSocketCount(),
|
socketCount: websockets.getSocketCount(),
|
||||||
|
|||||||
Reference in New Issue
Block a user