mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed SocketIO calls when pgAdmin 4 server is running from a sub directory. #5521
This commit is contained in:
@@ -8,10 +8,12 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
import { io } from 'socketio';
|
||||
import gettext from 'sources/gettext';
|
||||
import url_for from 'sources/url_for';
|
||||
|
||||
export function openSocket(namespace, options) {
|
||||
return new Promise((resolve, reject)=>{
|
||||
const socketObj = io(namespace, {
|
||||
path: `${url_for('pgadmin.root')}/socket.io`,
|
||||
pingTimeout: 120000,
|
||||
pingInterval: 25000,
|
||||
...options,
|
||||
@@ -24,11 +26,11 @@ export function openSocket(namespace, options) {
|
||||
socketObj.on('connected', ()=>{
|
||||
resolve(socketObj);
|
||||
});
|
||||
socketObj.on('connect_error', ()=>{
|
||||
reject();
|
||||
socketObj.on('connect_error', (err)=>{
|
||||
reject(err);
|
||||
});
|
||||
socketObj.on('disconnect', ()=>{
|
||||
reject();
|
||||
socketObj.on('disconnect', (err)=>{
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user