diff --git a/raspberry/roberto/views/websocket/routes.py b/raspberry/roberto/views/websocket/routes.py index f24b263..49a7277 100644 --- a/raspberry/roberto/views/websocket/routes.py +++ b/raspberry/roberto/views/websocket/routes.py @@ -91,8 +91,8 @@ def disconnect(): def connect(): sid = request.sid print("Received Connect message from %s" % sid) - socketio.emit('ready', room=ROOM, namespace='/webrtc', skip_sid=sid) - join_room(ROOM) if not webrtccamera.connected: webrtccamera.connect(socketio, ROOM, 'gstwebrtc1000') - + #socketio.emit('ready', room=ROOM, namespace='/webrtc', skip_sid=sid) + socketio.emit('ready', room=ROOM, namespace='/webrtc') + join_room(ROOM) diff --git a/raspberry/roberto/views/websocket/templates/camera.html b/raspberry/roberto/views/websocket/templates/camera.html index f78725c..1d87d7e 100644 --- a/raspberry/roberto/views/websocket/templates/camera.html +++ b/raspberry/roberto/views/websocket/templates/camera.html @@ -36,7 +36,12 @@ socket.on('data', (data) => { console.log('Data received: ',data); - var json_data = JSON.parse(data); + var json_data; + if (typeof data === 'string') { + json_data = JSON.parse(data); + } else { + json_data = data; + } handleSignalingData(json_data); });