Move web socket connection, responce/request logic to seporate method