elephant.io
elephant.io copied to clipboard
An error occurred while trying to establish a connection to the server
ı could not connect what I did
$client = new Client(new Version2X('http://localhost:3000'));
$client->initialize();
$client->emit('posts', ['age' => 28]);
$client->close();
js code
const index = require('http').createServer();
const options = {
cors: {
origin: '*',
},
};
const io = require('socket.io')(index, options);
index.listen(3000);
io.on('connection', function (socket) {
console.log('sockete birileri bağlandı.');
socket.on('posts', function (data) {
io.emit('posts', data);
});
socket.on('disconnect', function () {
console.log('birileri geldi ve gitti.');
});
});
https://github.com/Wisembly/elephant.io/issues/207
Sorry, the error still persists, the link was not resolved.
I have the same issues, but just in my local url. when I connect socket server in my production server, it works well. I can't know why
I converted socket to rest socket rest API , use socket as rest api...
https://github.com/diloabininyeri/rest-socket