Next.js Discord

Discord Forum

Standalone Build doesn't support web-sockets.

Unanswered
Papa Johns posted this in #help-forum
Open in Discord
I had tried standalone builds, I found out that websockets have some issues. I am not able to understand why doesn't websockets doesn't work in standalone builds.
I get that it creates a node server with only a index.js / server.js file that is directly executed using node index.js/server.js command.

14 Replies

Magnolia Warbler
I use pusher and it seems to work fine
but anyway, gonna need more info bud
let's say we create a chat app.
which contains websockets integration and other required apis.
In nextjss, on can integration that too for the same purpose.
I wanted to make sure that the build consumes less space, was trying to use standalone build
Somehow I don't know what happended, websockets tend to not work for that type of build
I am not able to understand what is the issue
the command goes as node server.js
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  experimental: {
    turbopackFileSystemCacheForDev: true,
  },
  output: 'standalone',
};

export default nextConfig;
the config file
@Magnolia Warbler
@Papa Johns Click to see attachment
it is in .next dir