It's not blocking. When you call an asynchronous `chrome` API (such as messaging), it just sends an internal message to the browser process, which then performs the actual work (connects to the native host) and sends the result back (the actual port handle in this case as opposed to the virtual one returned by chrome.runtime.connectNative in JS).
>
we can't create a new Worker within the service worker
This is unrelated and is caused by an intentional limitation of the service worker specification. Hopefully, it will be relaxed for extensions eventually, because this limitation doesn't make sense in case of extensions (similarly to the other limitations such as URL.createObjectURL) and forces us to use the clunky and wasteful chrome.offscreen API.
> when sending messages to the native messaging host, the service worker can't receive messages.
Sending a message starts with serializing the message into a string, which may take some time as Chrome is still using the super inefficient JSON stringification internally. A huge message may take many seconds to serialize. Since this is performed in the caller, it blocks the JS engine for the entire duration.
> is there a way to fix this?
Use a different connection mechanism such as WebSocket or WebTransport.
With the native messaging the only "solution" is to send smaller messages.