Establishing a communication pipeline with the web worker
We have now seen the key concepts that we want to apply to our implementation of the communication with web workers for our Vue application. This model can be used repeatedly from application to application and improved upon as needed. As a general plan of action, this is what we will build using the design patterns seen thus far:
- We will create a web worker with a single point of access in our Vue application, following the Business Delegate pattern
- Each message will raise an event to either process (parent-worker or worker-parent) and include command and payload data, as well as tracking information for scheduling as in the Dispatcher Pattern
Simple enough, the architecture described in the preceding points allows us to establish a workflow as shown here:
Figure 8.5 – Implementation of the communication workflow with the web worker
Now that we have the theoretical basis...