Hi Nilesh -- I'm not familiar specifically with the WebSockets code, but in general note that the JavaScript contexts for each thread are entirely separate and there's no way to directly work with JS objects belonging to one thread from another. If the WebSocket interface is opened and communication performed on the main thread, then the main thread must be available to respond to events and dispatch callbacks.
In general, the web platform wants you to minimize heavy CPU work on the main thread, as lots of stuff outside of your program needs CPU time -- the browser's event loop, painting, network i/o events, etc all need time on the main thread, and a blocking task will add latency. Some standard library functions may also proxy to the main thread, such as the filesystem, so a main thread with long delays on it will lead to delays elsewhere in the system.
I would recommend retooling your code to run heavy processing on side threads and keep the main thread as free as possible.
(It may also be possible to force the websockets code to run in a worker, but I don't know how offhand one would go about that. But even if you do that, the recommendation to avoid heavy CPU on the main thread stands.)
-- brion