N
Nuxt4mo 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
isakwang4mo ago
WebSocket - Nitro
Nitro natively support a cross platform WebSocket API
tiri
tiriOP4mo ago
don't wont for server side, only client side
isakwang
isakwang4mo ago
not sure what you mean
isakwang
isakwang4mo 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
isakwang4mo ago
But try that
tiri
tiriOP4mo ago
i dont want to use it as a server, only as a client and connect with this to a server
isakwang
isakwang4mo ago
Where is your server/what service? I know supabase has an implementation in their library if you use them
tiri
tiriOP4mo ago
no own implementation of a websocket server written in java
Cue
Cue4mo 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
tiriOP4mo ago
how can i disable this?
Cue
Cue4mo ago
ssr: false in your nuxt config
tiri
tiriOP4mo ago
got it, thanks worked thanks
Want results from more Discord servers?
Add your server