You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have been using this plugin for a while and is awesome, but there are two things I cant get to work:
I successfully bind function with OnConnect: SIOClientComponent->OnConnected.AddDynamic(this, &UfpsGameInstance::OnClientWsConnect);
where OnClientWsConnect is defined as: UFUNCTION() void OnServerWsConnect(FString SessionId);
but it doesnt work at all with OnDisconnect: SIOClientComponent->OnDisconnected.AddDynamic(this, &UfpsGameInstance::OnClientWsDisconnect);
where OnClientWsDisconnect is defined as: UFUNCTION() void OnClientWsDisconnect(TEnumAsByte<ESIOConnectionCloseReason> Reason);
SIOClientComponent->OnSocketNamespaceDisconnected.AddDynamic(this, &UfpsGameInstance::OnClientWsDisconnect) doesnt work neither.
And no matter I set SIOClientComponent->bShouldAutoConnect = false; it keeps reconnecting when server is again available and then sends all the messages not delivered.
Can you help me?
The text was updated successfully, but these errors were encountered:
You need to set bShouldAutoConnect before begin play happens for it to take effect. e.g. in your parent/owner class constructor. You should also be able to call SIOClientComponent->Disconnect() at any time to stop your component from reconnecting.
As for the bound connections, have you tried the blueprint equivalent versions and confirmed that these work as expected?
I have in my GameInstance constructor: SIOClientComponent = CreateDefaultSubobject<USocketIOClientComponent>(TEXT("SocketIOClientComponent")); SIOClientComponent->bShouldAutoConnect = false;
I have tryed setting it to false even in your USocketIOClientComponent constructor... but it keep reconnecting when the server is available again.
About the disconnected event, I have tryed it in bp too, but I only get the event when I call disconnect, not when I got disconnected, for example, closing my node.js server.
You should also be able to call SIOClientComponent->Disconnect() at any time to stop your component from reconnecting.
Right, but I cant do it if I dont know I lost my connection.
The new architecture has a new callback called OnConnectionProblems. By default the plugin will attempt re-connections an infinite amount of time so OnDisconnect never gets called in the case of a server being closed. You can now detect this state by subscribing to the above function which also gives you details such as time since last connection etc etc.
The other reconnection issue should now also be fixed, re-open the issue if you find that new architecture still has this problem.
Hi, I have been using this plugin for a while and is awesome, but there are two things I cant get to work:
I successfully bind function with OnConnect:
SIOClientComponent->OnConnected.AddDynamic(this, &UfpsGameInstance::OnClientWsConnect);
where OnClientWsConnect is defined as:
UFUNCTION() void OnServerWsConnect(FString SessionId);
but it doesnt work at all with OnDisconnect:
SIOClientComponent->OnDisconnected.AddDynamic(this, &UfpsGameInstance::OnClientWsDisconnect);
where OnClientWsDisconnect is defined as:
UFUNCTION() void OnClientWsDisconnect(TEnumAsByte<ESIOConnectionCloseReason> Reason);
SIOClientComponent->OnSocketNamespaceDisconnected.AddDynamic(this, &UfpsGameInstance::OnClientWsDisconnect)
doesnt work neither.And no matter I set
SIOClientComponent->bShouldAutoConnect = false;
it keeps reconnecting when server is again available and then sends all the messages not delivered.Can you help me?
The text was updated successfully, but these errors were encountered: