Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

fix: spotlight socket #707

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion context/Notification/NotifyContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function NotifyProvider({ children }) {

useEffect(() => {
fetch("/api/notifications").finally(() => {
const s = io();
const s = io("/");

Object.keys(fetchers).forEach((key) => {
s.on(key, (data) => {
Expand Down
7 changes: 6 additions & 1 deletion pages/api/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ function handleError(e: any) {

const ioHandler = async (req, res) => {
if (!res.socket.server.io) {
const io = new Server(res.socket.server);
const io = new Server(res.socket.server, {
cors: {
origin: "*",
},
addTrailingSlash: false
});

io.on("connection", (socket) => {
Object.keys(fetchers).forEach((key) => {
Expand Down
Loading