Skip to content

Commit

Permalink
fix: setting pathname for weboscket when pathname is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
vieiralucas committed Sep 16, 2024
1 parent e242c89 commit 0e2de79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/web/src/hooks/useWebsocket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ export function WebsocketProvider({ children }: Props) {
if (session.data) {
const url = new URL(NEXT_PUBLIC_API_URL())
const withoutPathname = url.origin

const socket = io(withoutPathname, {
withCredentials: true,
path: url.pathname + '/socket.io',
path: url.pathname === '/' ? undefined : url.pathname + '/socket.io',
transports: ['websocket'],
})
setSocket(socket)
Expand Down

0 comments on commit 0e2de79

Please sign in to comment.