Skip to content
GitHub Discord

AWS SolidStart WebSocket endpoint

Deploys a SolidStart app with a WebSocket endpoint in a container to AWS.

Uses the experimental WebSocket support in Nitro.

app.config.ts
export default defineConfig({
server: {
experimental: {
websocket: true,
},
},
}).addRouter({
name: "ws",
type: "http",
handler: "./src/ws.ts",
target: "server",
base: "/ws",
});

Once deployed you can test the /ws endpoint and it’ll send a message back after a 3s delay.

sst.config.ts
const vpc = new sst.aws.Vpc("MyVpc", { bastion: true });
const cluster = new sst.aws.Cluster("MyCluster", { vpc });
new sst.aws.Service("MyService", {
cluster,
loadBalancer: {
ports: [{ listen: "80/http", forward: "3000/http" }],
},
dev: {
command: "npm run dev",
},
});

View the full example.