-
Notifications
You must be signed in to change notification settings - Fork 9
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
io is not a function #9
Comments
have the same problem |
onMounted(() => {
const io = useIO();
const socket = io("http://127.0.0.1:7001/onlineCount");
}); is useful to me |
I have published a new version. This does not fix it but uses the latest Nuxt version. For the meantime, you can do what @huangbh1024 did, or const { $io } = useNuxtApp()
const connected = ref(false)
onMounted(() => {
const socket = $io('http://localhost:3069/');
socket.on('connect', () => {
connected.value = socket.connected
})
socket.on('disconnect', () => {
connected.value = socket.connected
})
}) |
I'll deprecate this feature soon in favor of this. |
@wobsoriano Is there a production version of this working? I get this error when I run build followed by $ node .output/server/index.mjs
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
TypeError [ERR_INVALID_FILE_URL_PATH]: File URL path must be absolute
at new NodeError (node:internal/errors:405:5)
at getPathFromURLWin32 (node:internal/url:1407:11)
at Object.fileURLToPath (node:internal/url:1437:22)
at file:///C:/Users/behon/Desktop/dev/nuxt-with-sockets-test/.output/server/chunks/nitro/node-server.mjs:5274:32
at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
code: 'ERR_INVALID_FILE_URL_PATH'
}
Node.js v18.18.1 |
@BayBreezy looks like I have to test it on windows 🫣 |
@wobsoriano oh ok cool.. Would love if this worked in production lol. |
@BayBreezy thanks for confirming that it's not working in production build on windows! |
@wobsoriano I can confirm that the built version works on a mac 👍🏽 When deployed to Netlify, it does not work. ❌ When deployed on Ubuntu Server, it works fine. ✅ When deployed behind nginx it also works fine. ✅ Sadly I don't have a paid heroku account to test it on I have not stress tested it yet but the few emits and listeners work great. Thanks for the module |
Confirming that it works on render.com too |
I get this error message when run nuxt after build it.
|
@Donny2333 Were you able to get yours working? |
My issues: io is not a function.
When used custom.
const io = useIO()
const socket2 = io('http://localhost:3069')
The text was updated successfully, but these errors were encountered: