peerjs: Not working with safari and chrome ios 13

I got this problem over chrome and safari, both desktop and mobile, initially it start the IceConnection, but after it got queued, it just stays in that state, and do not connect in anyway. I tried to read into some of the issues of the Git, but even with the change of the code (added URLS, used configs from PeerJs) on connection with Safari still have the problem. Somebody have any advice that can help me with this problem?
const peer = new Peer(id, {
host: '192.168.202.65',
port: 9000,
path: '/peerjs',
debug: 3,
config: {
iceServers: [
{urls: 'stun:stun.l.google.com:19302'},
{urls: 'turn:0.peerjs.com:3478', username: 'peerjs', credential: 'peerjsp'}
]
}
});
peer.on('open', () => {
peer.connect(this.anotherid, {
reliable: true
});
});
peer.on('connection', (conn) => {
console.log('connection');
conn.on('open', () => {
conn.send(new DataConnection('coordinate', {lat: this.lat, long: this.long}));
console.log('connected');
});
conn.on('error', (err) => {
Swal.fire({
icon: 'error',
title: 'ERRORE',
text: err
});
});
conn.on('close', (err) => {
console.log(err);
});
conn.on('data', (data) => {
this.action(data);
console.log(data);
});
this.conn = conn;
});
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 1
- Comments: 17 (1 by maintainers)
@riccag3 Thanks to the hint of maxpavlov, I fixxed it too in my project:
When connecting, the connection options, set serialization to ‘json’ (preferably only on Safari devices).
Here is some sample code on how I did it: