Unrecognized type 'FSocket'

Hello everyone, looks like I need your help once again =)

I’m not really sure if I’m doing thing in the right way, so here is what I’m trying to achieve;

I’m making an online game, where users must login first, so I’ll be abe to show em their statistics, bought items and so on. For this I have made so called “QueryServer” which is working with database, and managing UE4 dedicated serrvers, by launching instances for each game session.

So, simplified “login screen” → “game session” process looks like so:

    1. User is launched game client
  1. User enter his/her credentials
  2. Game client connecting to the “QueryServer”
  3. If OK, sending credentials to the “QueryServer” (SSL)
  4. The “QueryServer” processes the credentials and generating clientToken
  5. If OK, the “QueryServer” returns the clientToken, info about bought items, characters stats, etc. to the game client
  6. User gets to the next stage, where he sees his character, bought items, etc.
  7. User presses the "Play button
  8. The QueryServer building teams (Actually there is separated “TeamBuilder” server) and launching an UE4 dedicated server instance (actually there is always few more instances than needed)
  9. Users/Clients which will parcipiate in the game session (teams) will get a responce from the QueryServer, which contain information about UE4 dedicated server IP, port, etc.
  10. game starts…

I have wrote some nice code to communicate with the QueryServer, and it’s works like a charm. But when broke the code in methods, and added these to my BlueprintLibrary class, the compiler sad this: “Unrecognized type ‘FSocket’ - type must be a UCLASS, USTRUCT or UENUM”. Is there any way to use methods with FSocket* type in blueprints?

If no, what is the best place to define a “Global” variable, in C++ project, so i can store the connection there?
I mean a place, so i can define the variable once, and it will be defined until user close the game client…

Thank you for reading :slight_smile:

FSocket is non-UObject class and reflection system does not support those, so you can’t use it with UPROPERTY() or UFUNCTION() (only in function arguments and return value, in function you can use anything you want). So either you need to create UObject wrapper for FSocket (USocket?) or or deal with FSocket diffrently just in the way that UHT won’t see it.

It’s not recommended to use global variables, but in C++ it’s very simple, you just dealere one outside the class. UE4 it self got some global variables for main components (like GEngine for main UEngine pointer or GbIsEditor) and as you notice they have “G” prefix in name. you can also use static variables in classes (same as static function), they also work like global variable, if you really need global varable use it this way

Thank you for the clear answer.
Yes, I know, that global variables are evil. Maybe there is another solution, but I was unable to find one.

The thing i’m trying to do is:
When game client starts or maybe at GameMode constructor, connect to my QueryServer and store the connection, so i can reuse it at any moment. Sure using reconnect logic.
The point, is to create one single connection and reuse it, instead of creating 1 connection per request/response. The problem, is that I cannot find a good place for it :frowning:

Just another question, maybe I should just make new OnlineSubSystemModule? as the blueprints have already “Create Session”, “Is Logged In”, etc… Is there some manual for creating custom modules like online sub system?