Coder Social home page Coder Social logo

Comments (6)

Amaratsu avatar Amaratsu commented on June 20, 2024

You can use this plug-in as a project plug-in, or an Engine plug-in:

If you use it as a project plug-in, clone this repository into your project's Plugins directory and compile your game in Visual Studio. A C++ code project is required for this to work.

If you use it as an Engine plug-in, clone this repository into the Engine/Plugins directory and compile your game. Full Unreal Engine source code from GitHub is required for this.

This plug-in is enabled by default, so no need to enable it in the plug-in browser.

Link the SignalR module to to yours with PublicDependencyModuleNames or PrivateDependencyModuleNames in .build.cs:

PrivateDependencyModuleNames.AddRange(new string[]
{
"SignalR",
}
);
Create a hub connection with the SignalR engine subsystem:

#include "SignalRModule.h"
#include "IHubConnection.h"

TSharedPtr Hub = GEngine->GetEngineSubsystem()->CreateHubConnection("https://example.com/chathub");
Bind an event which is fired when the server call it to the client.

Hub->On(TEXT("EventName")).BindLambda([](const TArray& Arguments) {
...
});
Invoke fires an event when the server has finished invoking the method (or an error occurred). In addition, the event can receive a result from the server method, if the server returns a result.

Hub->Invoke(TEXT("Add"), 1, 1).BindLambda([](const FSignalRValue& Result) {
UE_LOG(LogTemp, Warning, TEXT("The result value is: %d"), Result.AsInt());
});
Unlike the Invoke method, the Send method doesn't wait for a response from the server.

Hub->Send(TEXT("Add"), 1, 1);

from unreal-signalr.

mostafabder1 avatar mostafabder1 commented on June 20, 2024

That’s what i have been doing for 5 days,
But nothing happened
Not even logs tells anything
Even OnConnectionError
And this library is the only for SignalR in UE :(
image

from unreal-signalr.

intelligide avatar intelligide commented on June 20, 2024

@mostafabder1 Have you called IHubConnection::Start() after binding the events ?

from unreal-signalr.

mostafabder1 avatar mostafabder1 commented on June 20, 2024

Yup, i did multiple debugging in Connection.Cpp , i found that FConnection::Negotiate has been called but the HttpRequest->OnProcessRequestComplete() listner doesn't been called so that never reached FConnection::OnNegotiateResponse
image

from unreal-signalr.

alexhajdu avatar alexhajdu commented on June 20, 2024

The plugin is definitely working, but strange enough, logs are not. I can confirm that. However, in the debug build, I was able to set break points to see, all is working as expected.
@mostafabder1 Try debug config and break-points

from unreal-signalr.

intelligide avatar intelligide commented on June 20, 2024

@mostafabder1 You just need to persist a reference to the connection object somewhere in your code to ensure that the object is not destroyed when the pointer is destroyed. As the functions are asynchronous, the shared pointer deletes the connection object before the negotiation with the server ended if there are no more references to the connection object.

from unreal-signalr.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.