daltoniam/starscream — pull request #18 by robskillington (2014-10-15 00:17:12+00:00)
Title: Avoid default priority queue which can be concurrent causing out of order messages delivered to delegate

Came across this using starscream in a library we are preparing to open source. It was causing painful issues as order really mattered for our callbacks. We could make our own background queue and ensure concurrency level 1 instead of this fix martialing back to the main thread, however I would assume most users will martial back onto the main thread themselves anyway for the majority of cases so might be better to perform this fix and then they can choose to pass the work onto the background if they truly want to do background processing before acting on the data.

- Fixing concurrent race that occurs when calling delegate with
websocketDidReceiveMessage and websocketDidReceiveData with a default
priority queue which so happens to have higher 1 concurrency level.
Also this ensures delegate is always fired on the main queue making
the library easier to use.
- Declare delegate as weak to avoid strongly holding onto the delegate.