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