Chat changes in 4.0.5.0

Using UE4/VS2015. This is about Chat. I know this is the native forum, but it's the C++ SDK and I <3 Kaiserludi.

So when doing opSendPrivateMessage, it used to ask for username and message. Now it asks for Channel Name instead of username. I was using this function as a sneaky little way to allow friends to setup matches with each; they exchange some info, setup a private room, and go to town. I'll probably also use it for... you know... actual private chatting.

Since it's now asking for channel name, my process doesn't work anymore. It used to be as simple as sending in a couple strings with the same unique account ID I use for connecting to the realtime server and all that.

So what's the standard process now for sending/receiving private messages? It seems to be a little different than a simple opSendPrivateMessage(*username, *message) like before.

Comments

  • KaiserludiKaiserludi admin
    edited January 2016
    Hi DG Gage.

    Don't worry.
    This is just a naming mistake on our side in the header file that we will fix for the next release.
    opSendPrivateMessage still expects a username, not a channelname. The implementation in the Client.cpp file also still uses userName as name for that parameter.

    PS:
    I <3 Kaiserludi.</p>
    Sorry, but I have to tell you that I am only into women ;)
  • Good to know, but I'm still having a new problem since upgrading to 4.0.5.0 where the sender name I receive from onPrivateMessage is a gigantic string of letters and numbers, and definitely not the username for the opSendPrivateMessage.

    That was with a test where I send a message to myself. I can't send seem to actually send chat messages to anyone. I'm putting the account id (what I use for username in sending message) into the connect() for realtime, but there's no argument for it in connect() for chat.

    Is the username of someone using chat established somewhere now that I'm not aware of? Do I have to use that AuthenticationValues() argument in chat's connect() now?

    This was all working before I upgraded, so maybe I need a refreshed walkthrough:

    What is the process for connecting to chat, and then sending/receiving private messages?

    And as a disclaimer, the user is indeed connection to chat and getting a valid response. That's the only part of my code for chat that's still working. (I pretty much only used that and private messaging)
  • Hi @DG Gage.

    Have you checked the release history files and made sure that you have adjusted your code to the mentioned changes?

    If you have done that and it does still not work as before, please provide us a minimal self-contained reproduction case.
  • DG GageDG Gage
    edited January 2016
    Lemme double check
  • Yeah so it's using AuthenticationValues now. How do I set the userID with that?
  • Ah okay I see now. Gotta instantiate AuthenticationValues, set whatever values I need, and send it into connect(). Pretty nifty.

    This did it:

    ExitGames::Chat::AuthenticationValues* authChat = new ExitGames::Chat::AuthenticationValues(); authChat->setUserID(*account); chatClient->connect(*authChat, *serverAddress);

    There was a weird error originally where it said it couldn't convert AuthenticationValues * to AuthenticationValues, so I added those pointers to fix it.
  • Hi @DG Gage.

    Are you originally coming from a Java/C# background?
    The reason why I ask is that you are using dynamic allocation without any real need here.

    Other than Java/C# do C++ due to its stronger focus on performance supports static allocation of class objects, so you do not have to use dynamic allocation for them and in fact should prefer static allocation whenever suitable to avoid the for most of the objects unnecessary overhead of dynamic allocation.

    So instead of
    ExitGames::Chat::AuthenticationValues* authChat = new ExitGames::Chat::AuthenticationValues();
    authChat->setUserID(*account);
    you would just write
    ExitGames::Chat::AuthenticationValues authChat;
    authChat.setUserID(*account);
    In connect() you would then also no longer need to dereference authChat, as it would not be a pointer to an AuthenticationValues object anymore, but it would be an AuthenticationValues object:
    chatClient->connect(authChat, *serverAddress);

    On another note AuthenticationValues supports function chaining for its setters. Therefor you can even do the following:
    
    chatClient->connect(ExitGames::Chat::AuthenticationValues().setUserID(*account), *serverAddress);
  • Hi @DG Gage.

    Are you originally coming from a Java/C# background?

    Sort of. I don't have much of a background, really. I learned C++ specifically for integrating online features into our mobile game and to expand my options when developing in the UE4 environment. Since then, though, I've developed a general interest in learning some of the top languages, so your info here is very helpful!

    I'm about to post what I think is a very nooby question to Native in a sec, so here comes the learning train. Hop on board kids.

  • Actually, your recent tips solved my other problem too! Sweet. Thanks! Looks like things are finally back to normal after the SDK update. Learned some valuable things from the process.
Sign In or Register to comment.