gfodor / p2pcf

Low cost, low effort P2P WebRTC serverless signalling using Cloudflare Workers
MIT License
952 stars 53 forks source link

critical: handle destroy state correctly #14

Closed ThaUnknown closed 2 years ago

ThaUnknown commented 2 years ago

this fixes an issue which would leak step and network intervals, which would accumulate over usage, especially for SPA's

this happened when a p2pcf instance was destroyed promptly after being created

gfodor commented 2 years ago

Ah this makes sense - thanks for the PR. If you don't mind, can you explain why you're creating + destroying P2PCF instances? Generally I have only been creating one per page context (even for a SPA.) Just curious to make sure I'm not overlooking anything.

ThaUnknown commented 2 years ago

joining and leaving lobbies which have different room codes

gfodor commented 2 years ago

Oh, of course. It might make sense to factor this differently and expose an API to switch rooms, to retain any cross room resources etc. Anyway, this lgtm, will merge today. Thanks!

On Fri, Aug 5, 2022 at 11:18 PM Cas @.***> wrote:

joining and leaving lobbies which have different room codes

— Reply to this email directly, view it on GitHub https://github.com/gfodor/p2pcf/pull/14#issuecomment-1207180893, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVW5ALP3ZLHGZ3Q6IDEM3VXYUVBANCNFSM55WOY4UA . You are receiving this because you commented.Message ID: @.***>