Skip to content

Commit 47f21da

Browse files
committed
added cors to socket.io server
1 parent 1c13425 commit 47f21da

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const DEFAULT_LIVE_UPDATE_PORT = 8088;
2020

2121
function startStaticPropsWatcher({ port }) {
2222
console.log(`[data-listener] create socket.io on port ${port} with namespace '/nextjs-live-updates'`);
23-
const io = socketIO(port);
23+
const io = socketIO(port, {
24+
cors: {
25+
origin: true
26+
}
27+
});
2428
const liveUpdatesIO = io.of('/nextjs-live-updates');
2529
liveUpdatesIO.on('connection', (socket) => {
2630
socket.on('disconnect', () => {

0 commit comments

Comments
 (0)