Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to run the "On Event" event on a separate thread? #172

Closed
steoniy opened this issue Nov 22, 2019 · 3 comments
Closed

Is there a way to run the "On Event" event on a separate thread? #172

steoniy opened this issue Nov 22, 2019 · 3 comments
Labels

Comments

@steoniy
Copy link

steoniy commented Nov 22, 2019

Hey Getnamo, cant stress how much I appreciate your work. Just have a question in regards to receiving events on a separate thread. I am using socketio to continuously pull in data from a stream. I noticed that when I try to transmit 100,000 records, the delay increases over time and the game thread is blocked until all events are received. I was wondering if you could guide me in the right direction so I can receive events without blocking game thread. Tysm! Currently am on UE 4.20 and SocketIO 0.95. I plan on upgrading soon but any help is appreciated.

EDIT: I know that SocketIO supports Blueprint multithreading, but specifically I need to receive events on a separate thread than Game Thread. Thanks!

@getnamo
Copy link
Owner

getnamo commented Nov 23, 2019

This is supported in v1.1.0 version of the plugin: https://github.com/getnamo/socketio-client-ue4/releases/tag/1.1.0 (#149 and #113 enhancements)

Using bind event to function, you can specify a thread override which has 3 options. Default (per socket.io component, typically game thread), game thread, and network thread. Setting the override to network thread should accomplish what you're looking for.

image

The cool part about this setup is that you can decide on a per bound event which thread you wish to receive the message, keeping other unsafe events e.g. on game thread.

NB: you cannot make or destroy uobjects on non-gamethreads and be mindful of your access patterns across threads to ensure you don't get a race condition.

@getnamo
Copy link
Owner

getnamo commented Nov 23, 2019

@steoniy
Copy link
Author

steoniy commented Nov 25, 2019

Wow, great! Thank you so much for the response as that is exactly what I have been doing.

@steoniy steoniy closed this as completed Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants