Describe the bug
Hello ! Since some weeks I try to make the example works and use it on another project. But still remain the same issue:
It's always un fucking CORS issue.
Everything is pretty simple:
Server side I tried with http.createServer, express and without (only io.listem() from gecko). Tested on both nodejs / bun
Client side I just tried to connect, with port change, etc
The snapshot-interpolation example is working on my Windows (WSL) computer, but now i'm on mac m2 and impossible to make it works.
Server.js
import express from 'express';
import geckos from '@geckos.io/server';
import http from 'http';
const app = express();
const server = http.createServer(app);
const io = geckos({ cors: {
origin: '*',
allowAuthorization: true,
} });
io.addServer(server);
io.onConnection(channel => {
console.log('CONNECTION !');
channel.onDisconnect(() => {
console.log(`${channel.id} got disconnected`);
});
channel.on('chat message', data => {
console.log(`got ${data} from "chat message"`);
// emit the "chat message" data to all channels in the same room
io.room(channel.roomId).emit('chat message', data);
});
});
server.listen(3000, () => {
console.log('Starting !');
});
app.get('/test', (req, res) => {
res.send('Test route OK');
});
On CORS options, I tried everything, evem to set false on the allow flag and 'localhost' etc on the origin
Client.js
const channel = geckos({
port: 3000,
});
channel.onConnect(error => {
if (error) {
console.error(error.message);
return;
}
channel.on('chat message', data => {
console.log(`You got the message ${data}`);
});
channel.emit('chat message', 'a short message sent to the server');
});
Have a question?
Is it working on M2 ? (I saw datachannel not prebuilt on m2).
Describe the bug Hello ! Since some weeks I try to make the example works and use it on another project. But still remain the same issue:
It's always un fucking CORS issue. Everything is pretty simple:
The snapshot-interpolation example is working on my Windows (WSL) computer, but now i'm on mac m2 and impossible to make it works.
Server.js
On CORS options, I tried everything, evem to set false on the allow flag and 'localhost' etc on the origin
Client.js
Have a question? Is it working on M2 ? (I saw datachannel not prebuilt on m2).