We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5b0e59 commit b6accfaCopy full SHA for b6accfa
src/content/docs/sandbox/api/ports.mdx
@@ -110,13 +110,14 @@ export default {
110
const sandbox = getSandbox(env.Sandbox, 'my-sandbox');
111
112
// Start WebSocket echo server
113
- await sandbox.writeFile('/workspace/server.js', \`
+ const serverCode = `
114
Bun.serve({
115
port: 8080,
116
fetch(req, server) { if (server.upgrade(req)) return; },
117
- websocket: { message(ws, msg) { ws.send(\\\`Echo: \${msg}\\\`); } }
+ websocket: { message(ws, msg) { ws.send(\`Echo: \${msg}\`); } }
118
});
119
- \`);
+ `;
120
+ await sandbox.writeFile('/workspace/server.js', serverCode);
121
await sandbox.startProcess('bun /workspace/server.js');
122
123
// Route WebSocket connections
0 commit comments