minor refactoring in _http_thread_func
minor refactoring in fulldepth_thread()
minor refactoring in history_thread()
minor refactoring in SocketIO.connect()
fix typo