Add on communication to external services

Hi all,
I’m completely new to add on development, had a read through the basic
principles and the cross browser development using browser extension api.

What I did not get is:
How would the extension communicate to services running in the internet?

Coming from a different field, I know mqtt, zeromq et.al. I guess the
best bet would be around webSockets for browser extensions?

The basic question is:
what would be the recommended approach to communicate with a server
/service from a browser extension api (compatibility for several
browsers) point of view?

A second question is (sorry for the porb. dumb newbie questions): can in
the background run any js code, e.g. any of the web API stuff?

Thank you for your kindness
Alex

I know only enough to get by regarding your first question, but regarding the question of JS code running in the background, this information helped me a great deal. See the background scripts link especially.

I think you would communicate with the server via the background script just as you would in any web page; but that’s not a strong point for me.