fix race condition in socket data listening
another approach for fixing the race condition. moved data listener to the end of the function
Merge pull request #212 from saschagehlich/bugfix/racecondition-data

Race condition: Socket's first data event received before readyState is OPEN
sync to ws upstream