Files
2025-05-04 22:26:56 +03:00

25 lines
996 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from misc.conversations import Conversations
from flask import Flask, request
from flask_socketio import join_room, leave_room
def init_socketio_handlers(socketio):
@socketio.on('connect')
def handle_connect():
print('Клиент подключился')
ip_address = request.remote_addr # Получение IP-адреса клиента
sid = request.sid
print(f'Клиент подключился с IP: {ip_address} SID: {sid}')
@socketio.on('disconnect')
def handle_disconnect():
print('Клиент отключился')
@socketio.on('new_problem')
def handle_message(data):
print('Получено сообщение:', data, ip_address)
conversation = Conversations().create(data.get("message"),data.get("work_place"),data.get("name"),data.get("problem"))
socketio.emit('response', {'data': conversation})
print(data)