UE · 2024年3月23日 1

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

This plug-in can use blueprints to create WebSocket servers and monitor response data.

The download address is at the end of the article.

1. Node description

Create Web Socket Server

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Create a WebSocket server object and listen to the corresponding port. The connection address is ws://IP:PORT, such as ws://192.168.1.5:9001

The returned object needs to be promoted to a variable, and this object will be used for operations in the future.


Bind – Bind callback function

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Bind server callback function

User Open: Called back when the user connects.

User Close: Called back when the user disconnects.

User Message: Message sent by the user

User ID: The user’s unique identifier, which can be saved when the user connects and used to send messages to the user in the future.

Data: User’s connection message, which can parse the user’s Protocols, Heads, and Params.

Message: Message sent by the user.


Close Server

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Close the current server. After closing, you can set the corresponding object to empty.

If you need to use it again, you need to recreate the server.


Get All Users

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Get all current connection user IDs.


Get User Data

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Get the connection information of the specified user.


Send Message

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Send string data to the specified user.

User ID: The user’s unique identifier, which can be obtained when the user connects.

Message: The string to be sent, which can be a Json string.


Close User

[Unreal Engine] DTWebSocketServer blueprint creation WebSocket server plug-in instructions

Actively disconnect the specified user.


2. Use Cases

In the plug-in, drag BP_DTWebSocketServerActor directly into the main scene to see it.


3. Download Link

Web Socket Server in Code Plugins – UE Marketplace (unrealengine.com)