Skip to content

Commit 13afcd1

Browse files
committed
I forgot the onmessage is being sent from a thread, so updated the _threadedSend
1 parent 7c480d2 commit 13afcd1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

source/funkin/backend/system/net/WebSocketUtil.hx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import hx.ws.*;
55
import funkin.backend.system.net.WebSocketPacket.ServerPacketData;
66
import funkin.backend.system.Logs;
77
import haxe.Unserializer;
8-
import Type;
8+
9+
import flixel.util.FlxTimer;
910

1011
/**
1112
* Basically a Utility for HScript to use WebSockets. Adds safeguards, error handling, and logging to debug your WebSockets.
@@ -236,8 +237,11 @@ class WebSocketUtil implements IFlxDestroyable {
236237
this.onError(e);
237238
}
238239
};
239-
if (this._threadedSend) Main.execAsync(_func);
240-
else _func();
240+
// because its already threaded.
241+
if (this._threadedSend) _func();
242+
else new FlxTimer().start(0.0001, (tmr:FlxTimer) -> {
243+
_func();
244+
});
241245
}
242246

243247
private var _isClosed:Bool = false;

0 commit comments

Comments
 (0)