#How to make Cloudflare websocket work with astro dev?
3 messages · Page 1 of 1 (latest)
Hi @sleek hazel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the provided documentation, there is no built-in way to make Cloudflare-specific modules like cloudflare:sockets work with the standard astro dev command.
The knowledge sources explicitly state that Cloudflare namespaced packages do not work locally without using Wrangler dev mode [Cloudflare module support].
To use these features locally, you must update your package.json preview script and run your application through Wrangler:
- For Workers:
"preview": "wrangler dev" - For Pages:
"preview": "wrangler pages dev ./dist"
Using Wrangler provides access to Cloudflare-specific features such as bindings, environment variables, and the cf object [Preview with Wrangler].