|
|
@ -61,26 +61,28 @@ ROOM = 'default' |
|
|
|
|
|
|
|
@websocket_blueprint.route('/camera') |
|
|
|
def camera(): |
|
|
|
return render_template('camera.html', room='default') |
|
|
|
return render_template('camera.html', room=ROOM) |
|
|
|
|
|
|
|
@socketio.on('message', namespace='/webrtc') # ok |
|
|
|
def webrtc_message(data): |
|
|
|
sid = request.sid |
|
|
|
print('Message from {}: {}'.format(sid, data)) |
|
|
|
socketio.emit('message', data=data, namespace='/webrtc', skip_sid=sid) |
|
|
|
socketio.emit('message', data=data, room=ROOM, namespace='/webrtc', skip_sid=sid) |
|
|
|
|
|
|
|
|
|
|
|
@socketio.on('disconnect', namespace='/webrtc') |
|
|
|
def disconnect(): |
|
|
|
sid = request.sid |
|
|
|
print("Received Disconnect message from %s" % sid) |
|
|
|
webrtccamera.disconnect_client(sid) |
|
|
|
leave_room(ROOM) |
|
|
|
webrtccamera.disconnect_client(sid, ROOM) |
|
|
|
|
|
|
|
@socketio.on('connect', namespace='/webrtc') |
|
|
|
def connect(): |
|
|
|
sid = request.sid |
|
|
|
print("Received Connect message from %s" % sid) |
|
|
|
webrtccamera.connect_client(sid) |
|
|
|
join_room(ROOM) |
|
|
|
webrtccamera.connect_client(sid, ROOM) |
|
|
|
|
|
|
|
@socketio.on_error_default |
|
|
|
def default_error_handler(e): |
|
|
|