from flask import session
from flask_socketio import SocketIO
import time
from application import create_app
from application.database import DataBase
import config

# SETUP
app = create_app()
socketio = SocketIO(app)  # used for user communication


# COMMUNICATION FUNCTIONS


@socketio.on('event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    """
    handles saving messages once received from web server
    and sending message to other clients
    :param json: json
    :param methods: POST GET
    :return: None
    """
    data = dict(json)
    if "name" in data:
        db = DataBase()
        db.save_message(data["name"], data["message"])

    socketio.emit('message response', json)

# MAINLINE

if __name__ == "__main__":  # start the web server 
    socketio.run(app, debug=True, host=str(config.Config.SERVER))
52000b71e96dbd544a62cc34f209bf902d7926d4
<mask token>


@socketio.on('event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    """
    handles saving messages once received from web server
    and sending message to other clients
    :param json: json
    :param methods: POST GET
    :return: None
    """
    data = dict(json)
    if 'name' in data:
        db = DataBase()
        db.save_message(data['name'], data['message'])
    socketio.emit('message response', json)


<mask token>

<mask token>


@socketio.on('event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    """
    handles saving messages once received from web server
    and sending message to other clients
    :param json: json
    :param methods: POST GET
    :return: None
    """
    data = dict(json)
    if 'name' in data:
        db = DataBase()
        db.save_message(data['name'], data['message'])
    socketio.emit('message response', json)


if __name__ == '__main__':
    socketio.run(app, debug=True, host=str(config.Config.SERVER))

<mask token>
app = create_app()
socketio = SocketIO(app)


@socketio.on('event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    """
    handles saving messages once received from web server
    and sending message to other clients
    :param json: json
    :param methods: POST GET
    :return: None
    """
    data = dict(json)
    if 'name' in data:
        db = DataBase()
        db.save_message(data['name'], data['message'])
    socketio.emit('message response', json)


if __name__ == '__main__':
    socketio.run(app, debug=True, host=str(config.Config.SERVER))

from flask import session
from flask_socketio import SocketIO
import time
from application import create_app
from application.database import DataBase
import config
app = create_app()
socketio = SocketIO(app)


@socketio.on('event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    """
    handles saving messages once received from web server
    and sending message to other clients
    :param json: json
    :param methods: POST GET
    :return: None
    """
    data = dict(json)
    if 'name' in data:
        db = DataBase()
        db.save_message(data['name'], data['message'])
    socketio.emit('message response', json)


if __name__ == '__main__':
    socketio.run(app, debug=True, host=str(config.Config.SERVER))

from flask import session
from flask_socketio import SocketIO
import time
from application import create_app
from application.database import DataBase
import config

# SETUP
app = create_app()
socketio = SocketIO(app)  # used for user communication


# COMMUNICATION FUNCTIONS


@socketio.on('event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
    """
    handles saving messages once received from web server
    and sending message to other clients
    :param json: json
    :param methods: POST GET
    :return: None
    """
    data = dict(json)
    if "name" in data:
        db = DataBase()
        db.save_message(data["name"], data["message"])

    socketio.emit('message response', json)

# MAINLINE

if __name__ == "__main__":  # start the web server 
    socketio.run(app, debug=True, host=str(config.Config.SERVER))