Move web socket connection inside of application