Changed order of initialization to first attempt WebSocket connection, and
after that image preloading.