Functioning duplex communication between main thread and web worker.