Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/ui/src/context/SocketProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export function SocketProvider({ children }) {
if (!providerConfig || !providerConfig.socketHost) return;
const { socketHost, socketPath, token } = providerConfig

const socketIo = io(socketHost, {
const socketIo = io(socketHost.replace('ws://', 'http://').replace('wss://', 'https://'), {
transports: ["polling"],
path: socketPath,
reconnectionDelayMax: 2000,
extraHeaders: {'Authorization': `Bearer ${token}`}
Expand All @@ -28,7 +29,7 @@ export function SocketProvider({ children }) {
socketIo?.on("connect_error", (err) => {
console.log(`Connection error due to ${err}`);
setConnected(socketIo.connected)
setError(`Socket connection error: ${err.message}`)
setError(`Socket connection error: ${err}`)
});
socketIo?.on('disconnect', () => {
console.log('needs reconnecting', socketIo)
Expand Down