elephant.io icon indicating copy to clipboard operation
elephant.io copied to clipboard

An error occurred while trying to establish a connection to the server

Open diloabininyeri opened this issue 4 years ago • 4 comments

ı 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.');
    });

});

diloabininyeri avatar Apr 14 '21 10:04 diloabininyeri

https://github.com/Wisembly/elephant.io/issues/207

sqlsystems avatar Apr 23 '21 10:04 sqlsystems

Sorry, the error still persists, the link was not resolved.

diloabininyeri avatar Apr 27 '21 15:04 diloabininyeri

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

daodhoa avatar Sep 20 '21 15:09 daodhoa

I converted socket to rest socket rest API , use socket as rest api...

https://github.com/diloabininyeri/rest-socket

diloabininyeri avatar Sep 20 '21 15:09 diloabininyeri