Addon Comms with AceComm 3
So I've been picking through AceComm 3.0 in conjunction with AceSerializer. I've managed to start to figure out how it's working. However, when I reload the UI, it always triggers OnCommReceived() once on reload/login with no values. IE: print(prefix, message, sender) at the start of OnCommReceived() returns nil nil nil.
It only does it once when the game is loaded in. After that it seems to work fine, sending messages on demand and never nil values. However, that initial set of nil values is where it's breaking AceSerializer. I'm able to serialize and send, but if I attempt to deserialize, it tries passing that nil value on reload/login and breaks the Lib entirely and can no longer be used. Error stating the Deserialize function expected a string but got the nil value. Any insight into what is causing that initial SendCommMessage to fire off?
Oh, and as an added note, it's only the root client that's receiving the nil values. Other clients in the group that receive the messages do not ever see it unless they themselves reload.
EDIT: I did work around it by filtering it through if prefix ~= nil. But is that the only way to really ignore it? Or is the initial failure a deeper bug on my behalf?
I'd check if prefix is equal to the one you registered for your addon. If user has any other addons loaded that use the comms channel, it may crash yours when you start receiving their data as well. Also, you need to make sure you aren't the sender. Most channels send an echo back with the player as the sender.
PS: I don't know, but it seems like OnCommReceived() being fired with nils is a deliberate design choice. I don't use AceComm, but the underlying API used to access these messages only fires when a message is actually received. It makes sense if it was intended to allow addons to initialize their comm channels. If this is an undocumented effect, I'd be wary of it changing or being removed in the future.
|All times are GMT -6. The time now is 10:57 PM.|
vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI