api/AceComm-3.0
AceComm-3.0 allows you to send messages of unlimited length over the addon comm channels.
It'll automatically split the messages into multiple parts and rebuild them on the receiving end.
ChatThrottleLib is of course being used to avoid being disconnected by the server.
AceComm-3.0 can be embeded into your addon, either explicitly by calling AceComm:Embed(MyAddon) or by
specifying it as an embeded library in your AceAddon. All functions will be available on your addon object
and can be accessed directly, without having to explicitly call AceComm itself.
It is recommended to embed AceComm, otherwise you'll have to specify a custom `self` on all calls you
make into AceComm.
AceComm:RegisterComm(prefix, method)
Register for Addon Traffic on a specified prefix
Parameters
- prefix
- A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent), max 16 characters
- method
- Callback to call on message reception: Function reference, or method name (string) to call on self. Defaults to "OnCommReceived"
AceComm:SendCommMessage(prefix, text, distribution, target, prio, callbackFn, callbackArg)
Send a message over the Addon Channel
Parameters
- prefix
- A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent)
- text
- Data to send, nils (\000) not allowed. Any length.
- distribution
- Addon channel, e.g. "RAID", "GUILD", etc; see SendAddonMessage API
- target
- Destination for some distributions; see SendAddonMessage API
- prio
- OPTIONAL: ChatThrottleLib priority, "BULK", "NORMAL" or "ALERT". Defaults to "NORMAL".
- callbackFn
- OPTIONAL: callback function to be called as each chunk is sent. receives 3 args: the user supplied arg (see next), the number of bytes sent so far, and the number of bytes total to send.
- callbackArg
I've been having all kinds of trouble with my callbacks and discovered that I was only getting 3 arguments passed to my callback function. That is, text, distribution, and sender. However, this is contrary to what I read in the Ace Tutorial. Any ideas on what's happening?
callbackFn, etc is available in the alphas right now off of the repo, and is pretty sweet :)
It's not in beta r820
As per galmok's request, I have added a comment to LibCompress about how to use LibCompress, AceSerializer, and AceComms to efficiently send arbitrary Lua data over an Addon message. You can view the comment here (just scroll down if the link doesn't quite work):
http://www.wowace.com/addons/libcompress/#c1
Prefix will need to be registered in 4.1
http://blue.mmo-champion.com/topic/163374/patch-41-addon-messages-will-be-filtered
regarding the 4.1 changes I'm wondering whether you think Ace will do the registration of the prefix because we are already passing you a prefix or whether authors will need to do register and do the AceComm part.
Im assuming that if Ace was to register on behalf of the addon that it would be identified as the actual addon and not Ace itself, but may need to wait and see.
Upy :)