socketsupply / socket

A cross-platform runtime for Web developers to build desktop & mobile apps for any OS using any frontend library.
https://socketsupply.co/guides
Other
1.6k stars 75 forks source link

fix(api/latica): allow PeerProxy create in Worker #983

Closed chrisfarms closed 2 weeks ago

chrisfarms commented 2 months ago

what

removes window reference and ensure worker spawned with full URL to allow using socket:network api from a Worker

why

so that I can setup network connections from Worker context

note

⚠️ PR against next

chrisfarms commented 2 months ago

LGTM. I want to check my understanding here though: So this says that instead of creating a worker for the window, it creates it for the global object? And rather than using pathname from import.meta.url your specifically getting the href? I'm unclear on the difference there

Read about globalThis here ... globalThis is sometimes the window, sometimes self, etc

"pathname" is relative, "href" is absolute ... worker's don't have a concept of relative, so needs to be absolute

jwerle commented 2 weeks ago

we fixed this in next and we actually handle relative paths for you in the Worker implementation :)