I’m currently working on a project where I’m trying to use data from a WebSocket server in Unreal Engine. I’ve created a C++ class UWebSocketConnectionWrapper
that connects to the server and receives data. I’ve declared a function OnMessageReceived
as a BlueprintImplementableEvent
in this class, which I want to use in a Blueprint to handle the received data.
Here’s the declaration of my UWebSocketConnectionWrapper
class:
cpp
UCLASS(BlueprintType)
class UWebSocketConnectionWrapper : public UObject
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "WebSocket")
void Connect();
UFUNCTION(BlueprintCallable, Category = "WebSocket")
void Close();
UFUNCTION(BlueprintImplementableEvent, Category = "WebSocket")
void OnMessageReceived(const TArray<FVector>& Landmarks);
private:
TUniquePtr<FWebSocketConnection> WebSocketConnection;
};
However, when I try to create a new Blueprint based on the UWebSocketConnectionWrapper
class, the class doesn’t appear in the list of available parent classes. Also, the OnMessageReceived
event doesn’t appear in the list of available nodes in the Blueprint editor.
I’ve made sure that my C++ code compiles successfully without any errors, and I’ve tried closing the Unreal Editor, recompiling my C++ code, and then reopening the editor to address any potential hot reload issues. My module is listed in the “Modules” section of my .uproject
file, and I’m using a version of Unreal Engine that’s compatible with my code.
I’m not sure what else to try at this point. Does anyone have any ideas on why the UWebSocketConnectionWrapper
class might not be appearing in the list of available parent classes, or why the OnMessageReceived
event might not be appearing in the list of available nodes in the Blueprint editor?
Any help would be greatly appreciated.