Skip to content

problem in reconnecting to socketio #40

Description

@MahdiRashidi2001

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions