N
Nuxt5mo ago
tiri

Native Websocket is not defined

Hi, i tried the native websocket like this but i got 500 > WebSocket is not defined. My IDE has no problem but nuxt has it. Then i installed this package but still same error because this package uses the native websocket
12 Replies
isakwang
isakwang5mo ago
WebSocket - Nitro
Nitro natively support a cross platform WebSocket API
tiri
tiriOP5mo ago
don't wont for server side, only client side
isakwang
isakwang5mo ago
not sure what you mean
isakwang
isakwang5mo ago
Alexander Lichter
YouTube
Integrating WebSockets in Nuxt and Nitro
🎉 Nitro 2.9 was released just before Vue.js Amsterdam and brings new features such as a database layer, a task API and also WebSocket support! But how can we integrate it in a Nuxt application? This video will teach you 👌 Key points: 🛠 How to set up WebSockets in Nitro and in Nuxt 💡 Working from scratch to a functional application ⚠️ Hints to m...
isakwang
isakwang5mo ago
But try that
tiri
tiriOP5mo ago
i dont want to use it as a server, only as a client and connect with this to a server
isakwang
isakwang5mo ago
Where is your server/what service? I know supabase has an implementation in their library if you use them
tiri
tiriOP5mo ago
no own implementation of a websocket server written in java
Cue
Cue5mo ago
Unless you’ve disabled SSR, you’ll need to conditionally instantiate a websocket instance in the client. The WebSocket is not defined reference error is usually a clue that its execution environment is server-side.
tiri
tiriOP5mo ago
how can i disable this?
Cue
Cue5mo ago
ssr: false in your nuxt config
tiri
tiriOP5mo ago
got it, thanks worked thanks
Want results from more Discord servers?
Add your server