-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for websockets #678
Comments
WebSocket support would be really nice, and more especially useful if it were implemented similar to what we've done with FeathersJS. We've created "transport" plugins that adapt requests from each transport into the same routes/functions on the backend. You also still have access to create custom entries that only work with a specific transport. Here are examples of the three primary transports that we bundle with FeathersJS Dove:
There's also a community-built adapter for Fastify, somewhere out there. It seems like a pretty Maybe it's worthwhile to create a Anyway, those are my thoughts. Use them as you wish, or not. 😁 |
Is this more feasable now with the release of Nuxt 3 stable? |
I'd also be interested in this. I want to use socket.io with nuxt3 and I'm struggling to make socket-io server work as nitroApp plugin. |
So, is it possible to somehow use Socket.io with Nitro? |
@NoeReverse I use it like this: import { Server } from 'socket.io'
export default defineNitroPlugin((nitroApp) => {
const socketServer = new Server(3001, {
serveClient: false,
cors: {
origin: '*'
}
})
socketServer.on('connection', (socket) => {
socket.on("message", async (message)=>{
socketServer.emit("message", {
type: "user",
author: message.author,
content: message.content
})
})
})
}) |
We are using ngrok and have not been able to get a solution for this. |
+1 |
The groundwork is currently being done in h3: unjs/h3#544 |
I played around with a few configurations of sockets in Nitro last week. But there's a bigger discussion to be had - Nitro is mean to "run anywhere". So, what would sockets look like on Nitro deployed to serverless? P.S. - my solution? |
I guess at first they would simply not be supported on most providers. However, some edge runtimes such as cloudflare workers do support websockets so this could become supported for them in the future. |
@marshallswain Do you have a plan to make It would be great. ;) |
Describe the feature
There are a few instances were support for websocket was wished for, or workarounds were discussed (see references below), but no I couldn't find a proper issue.
I would volunteer to help implementing websocket support, and formulate a proper RFC. But for this I first need a general direction and scope for this feature. @pi0 @danielroe
Questions to be clarified are: Do you want to implement this at h3, or only at the level of nitro? Should the presets handle ws support? How to include vendor-specific implementations like fastify-websocket?
References:
Additional information
The text was updated successfully, but these errors were encountered: