View Full Version : What's the Speed Limit on Chat channels?
Zillia Tippytoes
28-01-2007, 06:58 AM
I'm using the SendAddonMessage() function to send data between users of my guild-based add-on. There can be a lot of data so I'm using an _OnUpdate() function to break it into chunks instead of flooding it all at once.
What is the server-imposed speed limit for channel chatter? How much does it take to get you disconnected for apparent spam? How do you calculate a safe amount of time to wait between calls to SendAddonMessage()?
Duugu
28-01-2007, 10:59 AM
Around 900-1200 messages per second - can't remember the exact value. If send more messages you will be disconnected by the server.
Zillia Tippytoes
28-01-2007, 08:42 PM
900-1200? Really? That's a lot higher than I expected. Is that individual messages, regardless of length, or does the length of the messages make a difference?
Tunga
28-01-2007, 09:20 PM
I think it's data amount that counts, so length matters. For a laugh my mates used to get me disconnected by spamming my Whispercast: they'd say one word and I'd auto-reply with a sentence so they made a macro to whisper me 50 times and mash it, and I'd always get disconnected before them. I'd guess AddonMessages work in a similar manner.
Duugu
28-01-2007, 11:05 PM
I tested this ... almost 1 1/2 year ago. So it could be that they changed the max. amount of messages per second.
Can't say if the number of chars are relevant. I always send ~20 chars per message (if I remember correctly). I did some test to find out the limit and I remember that it was somewhere between 900 and 1200 at this time.
Zillia Tippytoes
29-01-2007, 06:17 AM
I see. Maybe the best approach would be to do a test myself. I already got disconnected while debugging but that was when my messages got sent out in an infinite loop so all I know so far is that the limit is less than infinity messages per second.
Zillia Tippytoes
29-01-2007, 06:48 AM
I did a test. Here are my results.
I tried a call to SendAddonMessage("zilliatest", msg, "GUILD") where msg was a string of about 230 characters.
Calling it 100 times at once worked fine.
Calling it 200 times at once worked fine.
Calling it 300 times at once resulted in a disconnection.
So I'm guessing the limit for chat messages of that length would be somewhere between 200 and 300 in a single call but, even if I assume a speed limit of 200, that's 200 calls in how much time?
So I did a second test where I sent the message 20 times at once every 5 seconds. Then every 4.9 seconds. Then every 4.8 seconds. And so on.
Disconnect occured between 1.2 and 1.1 seconds.
So that's a limit of 20 messages of around 250 characters in length every 1.2 seconds or about 16 messages of 250 characters every second or one message of 250 characters every 0.075 seconds.
aspinkorgall
29-01-2007, 02:26 PM
Don't forget then that whatever value you choose, if some other addon is also sending a great deal of data the user might end up disconnected anyway.
Zillia Tippytoes
29-01-2007, 08:49 PM
That's a good point. I was thinking about having my mod hook into SendAddonMessage() and count all the outgoing text, instead of just its own, when calculating a safe time to transmit more text.
Zillia Tippytoes
30-01-2007, 12:06 PM
I came up with a wacky solution. I added a saved variable called SPEEDLIMIT. Instead of calling SendAddonMessage() directly in my code, I call my own function which calls that function. My special function looks like this...
SPEEDLIMIT = SPEEDLIMIT + 1;
SendAddonMessage(prefix, msg, channel);
SPEEDLIMIT = SPEEDLIMIT - 1;
I'm only calling this function from my OnUpdate function which waits for SPEEDLIMIT seconds to pass before sending the next queued message.
The idea is that, if it does wind up sending too much text and forcing a disconnect, the value of SPEEDLIMIT will start as one second longer the next time the add-on is loaded because the disconnect will prevent the third line from being executed but will still cause variables to be saved.
It's a bit of a kludge but it nicely takes into account that different users may have different amounts of add-ons generating noise.
I capped the expansion to a maximum of 20 seconds between messages. More than 20 seconds will cause the add-on to generate a cautionary text at load time.
Wintrow
31-01-2007, 10:22 AM
You can also use the AceComm2.0 library which:
- allows sending complex data (like, tables and stuff)
- throttles the speed by itself
- compresses the data by invisibly replacing often used words with shorter versions
This way you can have great performance without worrying about the icky stuff :)
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.