console.error(error.stack || error);
},
+ connect() {
+ internals.port = chrome.runtime.connect({ name: "content" });
+ internals.port.onMessage.addListener(internals.onMessage);
+ },
+
async joinAudioCall({ currentUrl, tada }) {
try {
const mediaStream = await startMedia();
console.debug("disconnected from signaling server");
});
- socket.on("addPeer", ({ peerId }) => {
+ socket.on("addPeer", ({ peerId, shouldCreateOffer }) => {
addPeer({
peerId,
+ shouldCreateOffer,
mediaStream,
onOffer: (data) => socket.emit("relayOffer", data),
socket
},
};
-internals.port = chrome.runtime.connect({ name: "content" });
-internals.port.onMessage.addListener(internals.onMessage);
+internals.connect();
+chrome.runtime.onConnect.addListener(() => {
+ internals.connect();
+});
console.debug("Content Script Loaded");