<file_sep>from flask import Flask, render_template
from flask_socketio import SocketIO

app = Flask(__name__)

app.config['SECRET_KEY'] = 'secret'
socketio = SocketIO(app)


@app.route('/')
def chat():
    return render_template('chat.html')


def messageRecived():
    print('message was received!')


@socketio.on('my event')
def handle_my_custom_event(json):
    socketio.emit('my response', json, callback=messageRecived)


if __name__ == '__main__':
    socketio.run(app, debug=True)
<file_sep>![language](https://img.shields.io/badge/language-Python-brightgreen.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/enotcode/mypychat/master.svg?style=flat-square)](https://travis-ci.org/enotcode/mypychat)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/enotcode/mypychat.svg?style=flat-square)](https://scrutinizer-ci.com/g/enotcode/mypychat/?branch=master)
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](/LICENSE/)

# MyPyChat

Very simple chat on Flask and Socket.IO

# How to start?

```
git clone https://github.com/enotcode/mypychat.git
cd mypychat
pip install -r requirements.txt
python3 server.py
```

# Want to contribute?

Just fork and make a pull request – as easy as that ;)

# License

[MIT](/LICENSE/)
<file_sep>from server import app
import pytest


class Test:
    def test_homepage(self):
        with app.test_request_context('/'):
            assert ("Home page")
