Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

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

Open
diloabininyeri opened this issue Apr 14, 2021 · 4 comments

Comments

@diloabininyeri
Copy link

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

});
@sqlsystems
Copy link

#207

@diloabininyeri
Copy link
Author

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

@daodhoa
Copy link

daodhoa commented Sep 20, 2021

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

@diloabininyeri
Copy link
Author

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

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants