Skip to content

Instantly share code, notes, and snippets.

@Ntropish
Last active December 24, 2021 00:11
Show Gist options
  • Save Ntropish/c1caf297940e98d40be0220a8f26c5b0 to your computer and use it in GitHub Desktop.
Save Ntropish/c1caf297940e98d40be0220a8f26c5b0 to your computer and use it in GitHub Desktop.
Remix with Socket.io Recipe
// This approach uses:
// - Remix's Express Adapter
// - An external Socket.io server on port 3050
// - http-proxy-middleware
//
// install http-proxy-middleware and apply these lines to `server/index.js`:
//
const { createProxyMiddleware } = require("http-proxy-middleware");
// Add the middleware before remix's catch-all '*' route
app.use(
"/socket.io",
createProxyMiddleware({
target: "ws://localhost:3050",
ws: true,
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment