Event Binding
Reacting to server events in Blueprints
To make your custom UI react to the server, you must bind Custom Events in your Widget Blueprint to the MP_ChatClient component's Event Dispatchers.
Step 1: Get the Component Reference
Inside your main Chat Widget's Event Construct, get the Owning Player Controller and call Get Chat Client. Save this reference as a variable.
Step 2: Bind OnMessageReceived
This is the core event that updates your chat window. Drag off your reference and call Bind Event to OnMessageReceived.
- Create a Custom Event (e.g.,
HandleNewMessage). - Break the
FMP_ChatMessagestruct output. - Access
SenderName,MessageText, andTimestampto populate your text blocks.
Step 3: Bind Room Events
To dynamically add/remove chat tabs, bind to OnRoomJoined and OnRoomLeft. Use these to spawn or destroy UI tabs associated with the incoming RoomID.