#sockets in app directory
17 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
Websocket? Unfortunately, Next.js is built for serverless, which means you can’t run a websocket server without using a custom node.js server. Custom server isn’t allowed by platforms like Vercel, also not a recommended way.
Generally, we will use 3rd party services, such as Ably Realtime. They work great for serverless environments. Websocket needs an actual persistent server, and Next.js doesn’t come with that by default.
if you're hosting this nextjs app in a serverful environment then yes you can keep it in that file else you will need custom backend if you wanna host on vercel
I need free server which one can i use
is Ably Realtime free?
Yep
Correct
But considering the cost to host server, maybe simply using a service is better for small projects
i need it for small chat application
I built Shark chat, it’s a simple chat app, and it’s using Ably
you can use something like pusher for that
The price of Ably Realtime seems to be cheaper, you can take a look to their pricing
i dont know what is required for the task actually i have to ask and then i will see which service or platform i will use