Closed lucahttp closed 2 years ago
thank you, its solved
Here's an example for future users : Express part :
const express = require('express')
const { Server } = require('socket.io')
const http = require('http')
const app = express()
const server = http.createServer(app)
const io = new Server(server, {
cors: {
origin: '*',
methods: ['GET', 'POST', 'REMOVE']
}
})
const PORT = process.env.PORT || 8080
io.on('connection', (socket) => {
console.log('New socket user')
})
server.listen(PORT, () => { console.log(`Server started on port : ${PORT}`)})
Vuejs part :
import { createApp } from 'vue'
import App from './App.vue'
import VueSocketIO from 'vue-3-socket.io'
import SocketIO from 'socket.io-client'
const socketConnection = SocketIO('http://localhost:8080');
createApp(App)
.use(new VueSocketIO({
debug: true,
connection: socketConnection,
}))
.mount('#app')
Uncaught Error: Unsupported connection type at t.value (vue-socketio.js?5132:10) at new t (vue-socketio.js?5132:10) at eval (main.js?c6f4:35) at Module../src/pages/Home/main.js (index.js:1818) at webpack_require (index.js:849) at fn (index.js:151) at Object.2 (index.js:1855) at webpack_require (index.js:849) at checkDeferredModules (index.js:46) at index.js:925
im doing a proyect in my personal computer working ok also works fine in the server but when my colleague try to tun the same code get this error,
the web page are conected to the socket server in the cloud