Skip to content

Is there a way to serialize Peer object? #1093

Answered by jonasgloning
DeepBhat asked this question in Q&A
Discussion options

You must be logged in to vote

Serializing is not possible, as you can transfer neither the WebRTC connection nor the connection to the PeerServer.

I think the main problem is that WebRTC itself is not available in a Worker.
Working around that, you could:

  • Use PeerJS in one tab and relay messages to all tabs
  • Use one PeerJS instance per tab, sharing the IDs through the worker

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by DeepBhat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1092 on June 19, 2023 18:14.