mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
fix: Silent disconnect of pad (#6498)
This commit is contained in:
parent
649b6ef8b9
commit
166724dc13
3 changed files with 9 additions and 9 deletions
|
@ -131,7 +131,8 @@
|
||||||
"test-ui": "npx playwright test tests/frontend-new/specs",
|
"test-ui": "npx playwright test tests/frontend-new/specs",
|
||||||
"test-ui:ui": "npx playwright test tests/frontend-new/specs --ui",
|
"test-ui:ui": "npx playwright test tests/frontend-new/specs --ui",
|
||||||
"test-admin": "npx playwright test tests/frontend-new/admin-spec --workers 1",
|
"test-admin": "npx playwright test tests/frontend-new/admin-spec --workers 1",
|
||||||
"test-admin:ui": "npx playwright test tests/frontend-new/admin-spec --ui --workers 1"
|
"test-admin:ui": "npx playwright test tests/frontend-new/admin-spec --ui --workers 1",
|
||||||
|
"debug:socketio": "cross-env DEBUG=socket.io* node --require tsx/cjs node/server.ts"
|
||||||
},
|
},
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
|
|
|
@ -230,7 +230,7 @@ const handshake = async () => {
|
||||||
sendClientReady(false);
|
sendClientReady(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('reconnect', () => {
|
socket.io.on('reconnect', () => {
|
||||||
// pad.collabClient might be null if the hanshake failed (or it never got that far).
|
// pad.collabClient might be null if the hanshake failed (or it never got that far).
|
||||||
if (pad.collabClient != null) {
|
if (pad.collabClient != null) {
|
||||||
pad.collabClient.setChannelState('CONNECTED');
|
pad.collabClient.setChannelState('CONNECTED');
|
||||||
|
@ -251,9 +251,8 @@ const handshake = async () => {
|
||||||
// The socket.io client will automatically try to reconnect for all reasons other than "io
|
// The socket.io client will automatically try to reconnect for all reasons other than "io
|
||||||
// server disconnect".
|
// server disconnect".
|
||||||
console.log(`Socket disconnected: ${reason}`)
|
console.log(`Socket disconnected: ${reason}`)
|
||||||
if (reason !== 'io server disconnect' || reason !== 'ping timeout') return;
|
//if (reason !== 'io server disconnect' || reason !== 'ping timeout') return;
|
||||||
socketReconnecting();
|
socketReconnecting();
|
||||||
socket.connect();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,9 +270,9 @@ const handshake = async () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('reconnecting', socketReconnecting);
|
socket.io.on('reconnect_attempt', socketReconnecting);
|
||||||
|
|
||||||
socket.on('reconnect_failed', (error) => {
|
socket.io.on('reconnect_failed', (error) => {
|
||||||
// pad.collabClient might be null if the hanshake failed (or it never got that far).
|
// pad.collabClient might be null if the hanshake failed (or it never got that far).
|
||||||
if (pad.collabClient != null) {
|
if (pad.collabClient != null) {
|
||||||
pad.collabClient.setChannelState('DISCONNECTED', 'reconnect_timeout');
|
pad.collabClient.setChannelState('DISCONNECTED', 'reconnect_timeout');
|
||||||
|
|
|
@ -31,11 +31,11 @@ const connect = (etherpadBaseUrl, namespace = '/', options = {}) => {
|
||||||
|
|
||||||
socket.on('connect_error', (error) => {
|
socket.on('connect_error', (error) => {
|
||||||
console.log('Error connecting to pad', error);
|
console.log('Error connecting to pad', error);
|
||||||
if (socket.io.engine.transports.indexOf('polling') === -1) {
|
/*if (socket.io.engine.transports.indexOf('polling') === -1) {
|
||||||
console.warn('WebSocket connection failed. Falling back to long-polling.');
|
console.warn('WebSocket connection failed. Falling back to long-polling.');
|
||||||
socket.io.opts.transports = ['polling'];
|
socket.io.opts.transports = ['websocket','polling'];
|
||||||
socket.io.engine.upgrade = false;
|
socket.io.engine.upgrade = false;
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
|
|
||||||
return socket;
|
return socket;
|
||||||
|
|
Loading…
Reference in a new issue