getnamo / SocketIOClient-Unreal

Socket.IO client plugin for the Unreal Engine.
Other
895 stars 240 forks source link

use event dispatch for binding sockets #385

Open Bednaz98 opened 1 year ago

Bednaz98 commented 1 year ago

Hey, is it possible to have this plugin use dispatch events instead of having to list out the function in blueprints? This would make things a bit quicker and also feel more friendly to someone who uses blueprints instead of having to hardcode call back names.

I recently used an HTTP plugin that creates a rest server within blueprint and what it does is, it has a node that lets you define whether something is a post/get/etc as an enum option, and then it allows you to pass a string for the route name and then you pass in a call back function to execute when the server receives a request. This design pattern is rather nice and if it would be incorporated here that would be helpful.

getnamo commented 1 year ago

The plugin supports event dispatchers as an option for bind, see e.g. https://github.com/getnamo/SocketIOClient-Unreal#receive-to-delegate

If you're looking for callbacks I recommend using the emit with graph callback variant that returns a latent execution in line to your current graph (can be only used inside event graphs due to latent nature) https://github.com/getnamo/SocketIOClient-Unreal#emit-with-graph-callback

If these aren't what you're looking for, provide a screenshot of the blueprint flow you're trying to achieve.