connect to socket first before running app