How do I pass data to the server from the client using UI Input
I'm wondering how I can pass data to the server from the client using the UI. Kinda like a login screen, or a character creation system. Where you would enter things like Email and Password, Or Character Name.
The computer I'm building this project on doesn't have internet. And this laptop is a pain to transfer data to from it. So I'm trying to keep the question general. As a general understanding should solve future problems that are similar.
Currently I am drawing the login screen from the player controller. I am handling all button/event logic in the widget blueprint that would include the login button.(E.G Submit button)
I would like the server to handle the handshake with my network server. (Communication with the Database over HTTP) Unfortunately the widget blueprint doesn't have "Switch Has Authority" I'm using VaRest for HTTP calls. Are there any 'best practices' for passing data from specific clients to the server VIA User Interface Inputs (Input Text Block, Input Text Box, etc) Since I'm passing sensitive data such as usernames and passwords they shouldn't be accessible to other clients.
I understand if due to Unreal Engine limitations that I can't solve this problem exactly like this. I'm also open to C++ solutions of any technical level. I'm aware of variable replication and RPC calls. All help is appreciated.
asked Oct 25 '16 at 09:04 AM in Blueprint Scripting
Make custom events (if using blueprints) in your PlayerController. PlayerController is accessible anywhere, even in Widgets.
typical setup would be
[in Player controller blueprint] you need 2 custom events. SendLoginData without replication(client side) and one that will be executed on the server: ServerSendLoginData. (or any names you prefer).
[CustomEvent SendLoginData] -> [CustomEvent RunOnServer ServerSendLoginData]
You can have switch has authority in your ServerSendLoginData, for a little bit more protection if you'd like. Everything done in this custom event is only executed on the server, so other clients wont have access to this.
Mark as answered, if it helped you, cheers :)
Follow this question
Once you sign in you will be able to subscribe for any updates here