Fixed delayed sendMessage when waiting for connection.

Jira issue: wp-1330
Merge pull request #55 from TobyEalden/wp-1330-pr

Fixed delayed sendMessage when waiting for connection.