Improved reconnect functionality and removed a bug.

1.  Auto-reconnect is now also called on  IOError and SecurityError
events.

2. JavaScript callback on error is still functional; works alongside
reconnect.

3. On successful reconnection JavaScript function
"FlashlightOnReconnect" is called.

4. A bug removed. Reconnect function was being called repeatedly despite
success. It was due to timer not being stopped on successful
reconnection.
test

test