Web Socket Handshake in nodejs WS server

I am not able to establish the connection between my client(chrome) and server(nodejs web socket server). Once the server starts listening to the incoming requests, after 2-3 minutes the following error occurs: CALL_AND_RETRY_2 Allocation failed - process out of memory at my nodejs server and client says "INVALID_STATE_ERR: DOM Exception 11".

What is the solution?? How to quick fix this??

So onOpen is not getting called here.

I am reading a huge xml file at my server end using the following logic:

fileSystem.readFile('config.xml', 'ascii',
        function (err, data)     
            {               
            if (err)  
                throw err;  
            xmlData = data;  
           domParser = require('xmldom').DOMParser;  
            xmlDoc = new domParser().parseFromString(xmlData.substring(2,xmlData.length));  
             context = xmlDoc.getElementsByTagName("default")[0];  
        }    
);  

If I comment the above lines, it is working fine. But my requirement is to read and parse huge xml file. How can i achieve this?

Thanks
Sneha