Skip to content

Instantly share code, notes, and snippets.

@alex-hladun
Last active October 7, 2021 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-hladun/41ba9e7b0557b8e9f375aa8a8d6b4839 to your computer and use it in GitHub Desktop.
Save alex-hladun/41ba9e7b0557b8e9f375aa8a8d6b4839 to your computer and use it in GitHub Desktop.
Setting up cors on the back-end
// On the back-end
this.io = new Server(server, {
cors: {
// Would change origin to eventual DNS for React app
origin: "http://localhost:3000",
methods: ["GET", "POST"],
credentials: true
},
allowEIO3: true, // Whether to enable compatibility with Socket.IO v2 clients.
maxHttpBufferSize: 1024, // max message payload size (prevents clients from sending gigabytes of data)
pingInterval: 45 * 1000, // 45 seconds (less than ALB timeout)
pingTimeout: 4 * 60 * 1000 // 4 minutes
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment