peerjs icon indicating copy to clipboard operation
peerjs copied to clipboard

Feature/on-data

Open poison opened this issue 5 years ago • 2 comments

Hi,

Thanks for the amazing library, just discovered it when I'm playing around with WebRTC. I know it's maybe not intended, but I'm actually adding some custom code to the signalling peer-server I'm running (in order to create rooms). For this, I need to intercept messages from the signalling server itself. That's why I modified the code a bit.

It might be handy for other users too, let me know what you think.

Best regards, Nicolas

poison avatar Mar 30 '20 21:03 poison

I wanted to create a pull request but noticed that you did the exact same thing. I've used that message for notifying peerjs that their call-participant disconnected (since I didn't figure out how to do that with peerjs itself..)

I'd recommend creating a new ServerMessageType in lib.enums.ts and adding a new case-statement in lib/peer.ts instead of using the default-statement. See: https://github.com/Florrr/peerjs/commit/e8a2c48fae3f1cf559249cde0e889b1c2176a7f1

Florrr avatar May 20 '20 09:05 Florrr

Hi Florrr,

I suggest that I cancel my PR and you submit your PR with your suggestions. This one was done rather quick&dirty, and breaks backwards compatibility (the errors), while your suggestion seems the way to go.

I'm currently not using PeerJS in my project anymore since I have too many clients and the mesh became too heavy, so I have to use an SFU (mediasoup).

poison avatar May 20 '20 12:05 poison