Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem in reconnecting to socketio #40

Open
MahdiRashidi2001 opened this issue Oct 27, 2020 · 1 comment
Open

problem in reconnecting to socketio #40

MahdiRashidi2001 opened this issue Oct 27, 2020 · 1 comment

Comments

@MahdiRashidi2001
Copy link

hi,
I used this plugin ( dev branch and socket io version is 2) for connecting my game to socket io and handling Listeners and Emit.
so when I disconnect to the server my connection has closed but when i want to reconnect to the server in runtime after disconnecting , i think it cant connect to server correctly.

this is my connection script for this :

socketConnection = Socket.Connect(socketUrl);
            socketConnection.On(SystemEvents.connectError , (Exception e) => {
                Debug.Log("Socket.io Connection Error: " + e.ToString());
                Socket.Reconnect(socketConnection);
            });
            socketConnection.On(SystemEvents.connect, () =>
            {
                Debug.Log("Connected To Server");
                
            });
            socketConnection.On(SystemEvents.reconnect, (int reconnectAttempt) =>
            {
                Debug.Log("Reconnecting : " + reconnectAttempt);
            });
            socketConnection.On(SystemEvents.disconnect, () =>
            {
                Debug.Log("Connection is Closed");
            });

f.e when i connect to server for the first time i have this logs

[Singleton] An instance of socket.io.SocketManager is needed in the scene, so '(singleton) socket.io.SocketManager
socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk probed~
socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk ping~
socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk pong~
connected to server

but when i want to connect for the seccond time in runtime i just have this

socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk probed~

and i should mention this that i test Reconnect after an initial connection failure #34 issue and it couldnt help me

please check it and help me.

@MahdiRashidi2001
Copy link
Author

can someone help me with this?
it is urgent for me
thanks

@nhn nhn deleted a comment from swtalk Oct 28, 2020
@nhn nhn deleted a comment from swtalk Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant