Handle WebSocket through angular factory