alank
alank
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
I think that's exactly what I was looking for
25 replies
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
ty ty
25 replies
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
Ahh makes sense
25 replies
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
Nice! Will look into that. Will this run even if the popup is closed?
25 replies
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
Do I need GCM in order to reinstantiate or will a simple call to the BGSW turn the service worker from inactive to active?
25 replies
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
Interesting, still not sure I'm understanding the full flow of the BGSW. Essentially when I see service worker (inactive) the BGSW can be woken up and rehydrated with the data of the prior inactive worker. If my service worker is stateless is this is a major issue?
25 replies
PD🧩 Plasmo Developers
Created by alank on 6/5/2023 in #👾extension
Which is the current preferred method to wake a BGSW? FCM or WebSocket polling?
I may be misunderstanding, how can I send it in the BGSW if it's already inactive?
25 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
that fixed it for you?
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
so I cant seem to get the injected object into the tab although I can have it in an normal page
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Will ensure the tabs works and confirm
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Correct. Although right now I’m not doing it through the tab but rather calling the func from chrome devtools
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Can do, glad to help out 😄 and thank you for your time on this!
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Added this as another content script and it worked:
import type { PlasmoCSConfig } from "plasmo"

import { relayMessage, sendToBackground } from "@plasmohq/messaging"
import { relay } from "@plasmohq/messaging/relay"

export const config: PlasmoCSConfig = {
matches: ["<all_urls>"],
}

relay(
{
name: "request" as const
},
async (req) => {
const result = await sendToBackground(req)
return result
}
)
import type { PlasmoCSConfig } from "plasmo"

import { relayMessage, sendToBackground } from "@plasmohq/messaging"
import { relay } from "@plasmohq/messaging/relay"

export const config: PlasmoCSConfig = {
matches: ["<all_urls>"],
}

relay(
{
name: "request" as const
},
async (req) => {
const result = await sendToBackground(req)
return result
}
)
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Clutch!!!
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Here is what my src/tabs/test.tsx looks like when attempting to sendViaRelay from a tab.
import { sendViaRelay } from "@plasmohq/messaging"

function Test() {
// This is the same as the `useEffect` hook in React

return (
<div>
<button
onClick={async () => {
console.log("try to send to relay")
const hydrated = await sendViaRelay({
name: "request" as const
})

console.log(hydrated)
}}>
Hydrate options
</button>
</div>
)
}

export default Test
import { sendViaRelay } from "@plasmohq/messaging"

function Test() {
// This is the same as the `useEffect` hook in React

return (
<div>
<button
onClick={async () => {
console.log("try to send to relay")
const hydrated = await sendViaRelay({
name: "request" as const
})

console.log(hydrated)
}}>
Hydrate options
</button>
</div>
)
}

export default Test
19 replies
PD🧩 Plasmo Developers
Created by alank on 5/9/2023 in #👟framework
Not seeing background hits with use of relay
Also tried a similar example to this and didn't see the request in the BGSW land. https://github.com/PlasmoHQ/examples/blob/main/with-messaging/contents/index.ts
19 replies