This plug-in can use blueprints to create WebSocket servers and monitor response data.
The download address is at the end of the article.
目录(Contents)
1. Node description
Create Web Socket Server
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
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
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
Get all current connection user IDs.
Get User Data
Get the connection information of the specified user.
Send Message
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
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)
Awesome post.