GithubHelp home page GithubHelp logo

miguelgrinberg / flask-socketio-chat Goto Github PK

View Code? Open in Web Editor NEW
661.0 661.0 234.0 14 KB

A simple chat application that demonstrates how to structure a Flask-SocketIO application.

Home Page: http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent

License: MIT License

Python 53.80% HTML 46.20%

flask-socketio-chat's Introduction

Flask-SocketIO-Chat

A simple chat application that demonstrates how to structure a Flask-SocketIO application.

To run this application install the requirements in a virtual environment, run python chat.py and visit http://localhost:5000 on one or more browser tabs.

$ python chat.py

flask-socketio-chat's People

Contributors

dependabot[bot] avatar mgd722 avatar miguelgrinberg avatar vtjeng avatar wyattjia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-socketio-chat's Issues

emitting to server but not text area

When trying to implement Flask-SocketIO-Chat into a larger application, submitting a message registering on the server;

78dd74d50839443389dcb53a0cecd476: Received packet MESSAGE with 2/chat,["text",{"msg":"test"}]
received event "text" from 78dd74d50839443389dcb53a0cecd476 [/chat]

Though the message does not appear in the text area in the application itself.

I am using a Gunicorn server to run the application;

gunicorn -b localhost:8000 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker --reload "app:create_app()"

How can I fix this to show the message packets in the text area similar to the app?

Best way to embed Flask-SocketIO-Chat into another app?

Say we have another standalone running Flask app, how to embed and launch Flask-SocketIO-Chat when one of its navigational tabs is clicked:

@app.route(/chat):
def chat():
    return render_template(launch Flask-SocketIO-Chat here)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080, debug=True)

Since Flask-SocketIO-Chat is already launched from within chat.py?

I get this error when I use Hangul or Hanja characters in url.

my environment
python 3.5.3

pip list (Install with Flask-SocketIO-Chat/requirements.txt)
appdirs (1.4.2)
click (6.6)
eventlet (0.17.4)
Flask (0.11.1)
Flask-SocketIO (2.8.5)
Flask-WTF (0.9.5)
greenlet (0.4.2)
itsdangerous (0.24)
Jinja2 (2.8)
MarkupSafe (0.23)
packaging (16.8)
pip (9.0.1)
pyparsing (2.1.10)
python-engineio (1.2.4)
python-socketio (1.7.1)
setuptools (34.3.1)
six (1.10.0)
Werkzeug (0.11.10)
wheel (0.29.0)
WTForms (1.0.5)

I get this error when I use Hangul or Hanja characters in url.
ex) http://127.0.0.1:5000/漢字 , http://127.0.0.1:5000/한글

There is no problem when using only Flask or Flask-SocketIO.
Thank you.

Traceback (most recent call last):
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/eventlet/wsgi.py", line 454, in handle_one_response
result = self.application(self.environ, start_response)
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/flask/app.py", line 2000, in call
return self.wsgi_app(environ, start_response)
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/flask_socketio/init.py", line 42, in call
start_response)
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/engineio/middleware.py", line 49, in call
return self.wsgi_app(environ, start_response)
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/werkzeug/debug/init.py", line 464, in call
request.path == self.console_path:
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/werkzeug/utils.py", line 73, in get
value = self.func(obj)
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/werkzeug/wrappers.py", line 544, in path
self.charset, self.encoding_errors)
File "/Users/amro/PycharmProjects/test/lib/python3.5/site-packages/werkzeug/_compat.py", line 176, in wsgi_decoding_dance
return s.encode('latin1').decode(charset, errors)
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 1-2: ordinal not in range(256)

Commands

Is there a way to add a command to kick people? I have tinkered with this and made a /clear command but I also want /kick but I have no clue how to add /kick. Is there a way?

failed to install requirements on windows due to greenlet

got this output when attempting to install requirements:

..."Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for greenletFailed to build greenlet
ERROR: Could not build wheels for greenlet, which is required to install pyproject.toml-based projects

it may be related with my python installation from windows store.

attempted to manually install it and found only flask_wtf and flask_socketio is required be manually installed to run this example, other requirements like flask and jinja is automatically installed, and greenlet is not included, also version of package does not affect the function.
Therefore, I'm suggesting a slimmed down requirements.txt file.

Centos 6.6 python 2.6.6 error

getting this error on centos

Traceback (most recent call last):
File "chat.py", line 2, in
from app import create_app, socketio
File "/var/www/html/Flask-SocketIO-Chat-master/app/init.py", line 2, in
from flask_socketio import SocketIO
File "/usr/lib/python2.6/site-packages/flask_socketio/init.py", line 481
ssl_params = {k: kwargs[k] for k in kwargs if k in ssl_args}

Please help.
Thank you

Clean install virtualenv error

Thanks so much for the example.

Having this error when performing a clean install in a virtualenv:
ERROR: Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 12)) (from versions: none) ERROR: No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 12))

#question: adapting your example to a chatbot server

Hi Miguel, thanks for posting this neat example. I'm flask newbie who's learning the ropes through your tutorials and book.

I have a "back-end" code that takes as input free-form text and classifies the corresponding intent. It's a basic sklearn-kit model.

I'm trying to adapt your code to have a person chatting with the bot (which will have a hard-coded waterfall on top of the ML logic to emulate some basic interaction).

What I'm trying to do (for a prototype) is to have the conversation thread bot-human displayed in a window as per your example -- I'd like messages appended on the same screen.

Do I need to connect the bot the chat room? Any pointers or resources to look at are very welcome.

Anyhow, I'll keep plodding along. Many thanks, Alex

Accessing to application context in a background task with Blueprints

Hi again @miguelgrinberg !

In my last issue miguelgrinberg/Flask-SocketIO#651 I wasn't clear enough.

I am working on an application with the same archetype as this one (Flask-SocketIO-Chat).
I want to request the database inside a background task but if I invoke the code below, no notifications are sent. I am using eventlet.

This is my events.py

import os
from threading import Lock

from .. import socketio, create_app
from app.emc_core.models import Alert

thread = None
thread_lock = Lock()

def notifications_job():
    last_alert_id = None
    
    app = create_app(os.getenv('FLASK_SETTINGS_MODULE'))

    with app.app_context():
        while True:
            socketio.sleep(app.config.get('NOTIFICATIONS_TIMER', 60))
            # Check for new alerts
            last_id = Alert.get_last_alert_id()
            if last_alert_id is not None and last_id != last_alert_id:
                notifications['last_alert_id'] = last_id
                socketio.emit('new_notification', {'msg': 'new alert', 'last_id': last_id}, namespace='/rt/notifications/')
            last_alert_id = last_id


@socketio.on('connect', namespace='/rt/notifications/')
def start_notifications_thread():
    global thread
    with thread_lock:
        if thread is None:
            thread = socketio.start_background_task(target=notifications_job)

And this is my init.py for app:

from flask import Flask
from flask_marshmallow import Marshmallow
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()
ma = Marshmallow()

# Set this variable to "threading", "eventlet" or "gevent" to test the
# different async modes, or leave it set to None for the application to choose
# the best option based on installed packages.
async_mode = 'eventlet'
socketio = SocketIO(async_mode=async_mode)


def create_app(settings_module):
    app = Flask(__name__, instance_relative_config=True)
    # Load the config file specified by the FLOODSERV_SETTINGS_MODULE environment variable
    app.config.from_object(settings_module)
    # Load the configuration from the instance folder
    app.config.from_pyfile('config.py')

    db.init_app(app)
    ma.init_app(app)
    socketio.init_app(app)

    # Blueprints registration
    from app.emc_core.api_1_0 import emc_1_0
    app.register_blueprint(emc_1_0)

    from app.pois.api_1_0 import pois_1_0
    app.register_blueprint(pois_1_0)

    from app.sensor.api_1_0 import sensor_api_1_0
    app.register_blueprint(sensor_api_1_0)

    from app.ui import ui
    app.register_blueprint(ui)

    # Here events blueprint is registered
    from app.rt import real_time_events
    app.register_blueprint(real_time_events)

    return app

Any suggestions?

Alternative to window.location.href

Hi, I'm studying this example right now and was wondering if there was an alternative to using window.location.href to go back to the login page (shown below):

function leave_room() {
socket.emit('left', {}, function() {
socket.disconnect();
// go back to the login page
window.location.href = "{{ url_for('main.index') }}";
});
}

I was thinking I could add return redirect(url_for('main.index')) after the call to emit here:
@socketio.on('left', namespace='/chat')
def left(message):
"""Sent by clients when they leave a room.
A status message is broadcast to all people in the room."""
room = session.get('room')
leave_room(room)
emit('status', {'msg': session.get('name') + ' has left the room.'}, room=room)

but that didn't work. I also added from . import main and from .routes import * to the top of events.py.

If not, what is the situation that we are facing here that necessitates using window.location.href?

Scaling with Redis

I have been trying to slightly modify the code to use my local instance of Redis by providing it with the redis:// argument as the message_queue argument on the following

socketio.init_app(app)
becomes
socketio.init_app(app, message_queue='redis://').
According to my reading of the documentation, that is all I need for accomplishing what I'm attempting here and it does seem to work to some extent because when I monitor my redis from another terminal (redis-cli monitor), I see the application subscribing to the flask-socketio channel once I fill out the initial form for joining a room. However, after being redirected to the chat room page, socketio attempts to make a connection to the server multiple times but all those requests never seem to return as they show up as pending in my Chrome dev tools. Below is a screenshot of that.
screen shot 2018-03-07 at 7 18 53 am
Have I missed something in the configuration step for this?The behavior I'm expecting is to be able to instantiate two servers on different ports and let's say I join room 1 on both from different browser windows, then I should be able to send a message from one window to the other. I have done something similar in NodeJs and it worked fine but I'm having trouble replicating the same behavior here.

Server receives event correctly, but It doesn't execute method

I have written my code as the below. I pretended to print sentence when the event named 'my event' occurred.

@socketio.on("my event", namespace="/v1/chat")
def my_event():
    logging.info("Listening My Event")

However, It doesn't execute method. The below is logcat from my flask sever.

12-07-2018:06:58:31,132 INFO     [socket.py:52] b9b1bbe8e27541a9837476022e7e9b89: Received packet MESSAGE data 2/api/v1/chat,["my event",{"data":"I'm connected!"}]
12-07-2018:06:58:31,132 INFO     [server.py:453] received event "my event" from b9b1bbe8e27541a9837476022e7e9b89 [/api/v1/chat]

How can I solve this problem?

Socket Handlers not being Triggered Even after i've imported them

Hi @miguelgrinberg hope you're doing great, Paul here! (from the geoalchemy issue on flask-migrate a few weeks ago, big fan!). I am having some issues with getting my socketio handlers to work. I noticed a common cause that you've addressed in the past is "not importing them into your blueprint" so i have made sure to do that. My project structure is a lot like the one in this chat example, only i have more blueprints inside of a parent folder, its like this:

projectfolder/
   - core/
       | - __init__.py 
       | - bookings (blueprint)/
          | - __init__.py
          | - events.py
          | - views.py
       | - other blueprint
       | - other blueprint
   - wsgi.py

Here's what I have in bookings blueprint init.py file:

# flake8: noqa

from flask import Blueprint

bookings = Blueprint(
    "bookings", __name__, url_prefix="/bookings",
    template_folder='templates', static_folder='static'
)

from . import views, events

I have imported the events as you can see here.

In the bookings events.py file i have added the following handlers:

from core import socketio
from flask_socketio import send, emit
from flask import request
from core import db
from models.utils import Socket
from tasks.push_booking_to_queue import pbq
from extensions import redis_
import pygeohash as pgh

@socketio.on('location_update', namespace='/artisan')
def update_location(data):
    # update artisan location on redis
    redis_.geoadd(
        name="artisan_pos",
        values=(data['lat'], data['lon'], data['artisan_id'])
    )


#  option one
@socketio.on('order_updates')
def get_updates(data):
    # add client to special room
    room = request.sid
    # continually query celery for updates
    while True:
        task = pbq.AsyncResult(data['task_id'])
        if task.state == 'SUCCESS':
            result = task.info.get('match_profile')
            send(result, to=room)
            break


@socketio.on('accept_offer')
def offer(data):
    room = request.sid
    # notify client of update
    # order =
    emit('message', data, to=room)
    print(data)


@socketio.on('connect')
def connect():
    emit('welcome', 'welcome!', broadcast=True)
    print('someone connected')

Here i anticipate that the connection handler at least works but not any of the handlers are being triggered.

Here's the app factory in core/__init__.py

from flask import Flask
from config import config_options, DevConfig
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from flask_migrate import Migrate
from flask_socketio import SocketIO
from celery import Celery
from flask_cors import CORS

# instantiate extensions
db, ma = SQLAlchemy(), Marshmallow()
socketio = SocketIO()
migrate = Migrate(include_schemas=True)
celery = Celery(__name__, broker=DevConfig.CELERY_BROKER_URL)
cors = CORS()


#  app factory
def create_app(config_name):
    app = Flask(__name__)

    # configure application
    app.config.from_object(config_options[config_name])

    # link extensions to app instance
    db.init_app(app)
    ma.init_app(app)
    migrate.init_app(app, db)
    celery.conf.update(app.config)
    cors.init_app(app)

    # register blueprints
    from .bookings import bookings
    from .payments import payments
    from .ratings import ratings
    from .security import security
    from .user import user

    app.register_blueprint(bookings)
    app.register_blueprint(payments)
    app.register_blueprint(ratings)
    app.register_blueprint(security)
    app.register_blueprint(user, url_prefix='/user')

    # socketio.init_app(app, async_mode="eventlet", engineio_logger=True)
    socketio.init_app(app)
    return app

And finally the wsgi.py file which runs the application:

# flake8: noqa

from json import load
from core import create_app, socketio
from dotenv import load_dotenv
from models.user_models import *
from models.base import *
from models.documents import *
from models.address import *
from models.bookings import *
from models.ratings import *
from models.location import *
from models.payments import *
from models.utils import *
import os


load_dotenv()

app = create_app(os.getenv('FLASK_CONFIG') or 'default')


@app.shell_context_processor
def make_shell_context():
    return dict(app=app, role=Role)


if __name__ == "__main__":
    # socket.run(app, host="0.0.0.0", port=5000)
    socketio.run(app)

I don't know if this is a consequence of putting all my blueprints in a package, because i see that your chat app example only has one blueprint which is on the same level as the chat.py that runs the application. Hopefully this is descriptive enough, i look forward to hearing from you, thank you!.

I get 500 bad response error when i use it along with gunicorn

website_1   | 172.18.0.1 - - [06/Apr/2017:02:36:20 +0000] "GET /socket.io/?EIO=3&transport=polling&t=1491446149614-17&sid=1bd2a25fa898425ea117df5ea5492f8b HTTP/1.1" 400 11 "http://local.docker:9000/chat/chatroom" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
website_1   | 172.18.0.1 - - [06/Apr/2017:02:36:20 +0000] "POST /socket.io/?EIO=3&transport=polling&t=1491446174928-18&sid=1bd2a25fa898425ea117df5ea5492f8b HTTP/1.1" 400 11 "http://local.docker:9000/chat/chatroom" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
website_1   | 172.18.0.1 - - [06/Apr/2017:02:36:21 +0000] "POST /socket.io/?EIO=3&transport=polling&t=1491446181593-19&sid=1bd2a25fa898425ea117df5ea5492f8b HTTP/1.1" 400 11 "http://local.docker:9000/chat/chatroom" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
website_1   | 172.18.0.1 - - [06/Apr/2017:02:36:23 +0000] "GET /socket.io/?EIO=3&transport=polling&t=1491446183092-20 HTTP/1.1" 200 119 "http://local.docker:9000/chat/chatroom" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
website_1   | 172.18.0.1 - - [06/Apr/2017:02:36:23 +0000] "POST /socket.io/?EIO=3&transport=polling&t=1491446183102-21&sid=6020b18d861b419d82f1e5d0881a7496 HTTP/1.1" 200 2 "http://local.docker:9000/chat/chatroom" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"

My gunicorn command ( i run this in my dockerfile )-
CMD gunicorn -b 0.0.0.0:9000 --worker-class eventlet --access-logfile - "my.app:create_app()"

My requirements.txt
eventlet==0.17.4
flask-socketio
greenlet==0.4.2

I'm not able to figure out why its not working when i integrate this into my app. When i run this separately it works. Please help!

How best to test WS events?

Hey Miguel,

I'm playing around with building a chat app API/backend using Flask-SocketIO. However, I'm currently stuck trying to test socketio events. With standard RESTful endpoints, I can easily use curl or HTTPie. But what about testing something like joining a room? E.g.

@socketio.on('join')
def on_join(data):
    username = data['username']
    room = data['room']
    join_room(room)
    send(username + ' has entered the room.', room=room)

Am I missing something?

Thanks!

Understanding the structure

Hi Miguel,

I have a couple of questions about this example:

  1. In your code you don't have any lines like this: app.register_blueprint(...). I normally have this in my main entry point after I've gotten an 'app' instance. Is this unnecessary? I wanted to understand this better.
  2. I found this example code while trying to understand how to use Blueprint with websockets. Based on your code it looks like Blueprints (and any kind of 'url_prefix') aren't used with websockets, and any kind of 'url_prefix' should be handled with a socketio namespace parameter in the decorator. Is that correct?

Thanks in advance for your help!
Doug

Changing the host parameter

Hi Miguel,
I'm trying to change the default host (127.0.0.1) to e.g 192.168.1.5
Following the next steps I still get wsgi starting up on http://127.0.0.1:5000 when I run the app

Edit: /app/init.py
Change: def create_app(debug=False): to def create_app(host=None, debug=False):
Add: app.host = host to the above function (above app.debug)

Edit: /chat.py
Change: app = create_app(debug=True) to app = create_app(host='192.168.1.5', debug=True)

What am I missing?

Not working on Google chrome

Hi I tried running the chat application on my MAC book os version 10.13.3 and chrome Version 71.0.3578.98 .

CFDLMC2286:Flask-SocketIO-Chat-master shyamsudhir$ pip freeze
Click==7.0
Django==1.11.17
dnspython==1.16.0
enum34==1.1.6
eventlet==0.24.1
Flask==1.0.2
Flask-SocketIO==3.2.1
Flask-WTF==0.14.2
greenlet==0.4.15
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
monotonic==1.5
mysqlclient==1.3.14
python-engineio==3.3.1
python-socketio==3.1.2
pytz==2018.7
six==1.12.0
Werkzeug==0.14.1
WTForms==2.2.1

I could just see OK displayed on the browser when typed http://localhost:5000
Same problem with safari 11.0.3

Making calls to external API with only 1 gunicorn worker

Left a comment on a separate issue but realized it was already closed. Just to be clear, when I run gunicorn --worker-class eventlet -w 1 app:app, there is only one worker so I can't make calls to external APIs? I am trying to save my chat to a Firebase database and whenever I try to do so my gunicorn has a WORKER TIMEOUT.

Example code with Auth key at the time of connect

Thank you for sharing the great example of Flask-SocketIO....

I am trying to get authentication token at the time of connect, can you update your sample code with passing Authkey at the time of connect??

Flask-socketio nginx

Hi, I've got flask app with chat page, while testing on local machine it works perfect, but when trying deploy online using nginx, gunicorn, chat page not works, got errors in browser console like:
index.js:83 POST https://.../socket.io/?EIO=3&transport=polling&t=N9qSenM&sid=dd49a7b4091448f2a3fa2b260cd8d569 400 (BAD REQUEST)**
And nginx errors like this:
connect() failed (111: Connection refused) while connecting to upstream, client: 95.153.48.256, server: 3.137.153.143, request: "GET /socket.io/?EIO=3&transport=polling&t=N9qPpaJ HTTP/1.1", upstream: "http://127.0.0.1:5000/socket.io/?EIO=3&transport=polling&t=N9qPpaJ", host: "3.137.153.143", referrer: "https://3.137.153.143/chat"
Is it possible to make it alive?
Thanks.

Trying to make a chatbot

hi,
I'm trying to do a chatbot, I already can make it work in a terminal but I would like to develop it in a web front end. I do not know much about web develop, What I would like to know is if it is possible to do something like my code bellow, but in flask socketio.

Here the user ask the bot to show a Painter art, by giving it's name and having the artist's name, it display all it's art names and after been chosen it display in screen.

user_input = " "
while TRUE:
  response = send_message(user_input, context)
  if response['intents'] and response['intents'][0]['intent'] == "user_paint":
    user_input = input(">> ")
    response = send_message(user_input, context)
    context = response['context']
    painter = response['entities']['entity' == "painter_name"]['value']
    #print bot response
    if response['output']['text']:
        print(response['output']['text'][0])
    #get paint description
    user_input = input(">> ")
    response = send_message(user_input, context)
    context = response['context']
    if response['output']['text']:
        print(response['output']['text'][0])
    art_name = response['entities']['entity' == "art_name"]['value']
    show_data(painter_name, paint)
  # Prompt for next round of input.
  user_input = input('>> ')

I'm having trouble thinking how can I do to make a "wait user input " button like "input()" in flask-socketio.

How to implement socket-io for a chat app to be hosted on IBM Bluemix and connects with Watson Conversation API

Hello Miguel,

I would like your help to develop a chat app that builds on Python Flask micro-framework, uses socketIO but hosted through IBM Bluemix cloud platform.

I have cloned your repository and added the following files for cloud deployment:

  1. Procfile
  2. Runtime.txt
  3. Manifest.yml

However, the app won't start as it give the following error:
screen shot 2017-02-08 at 11 43 40

Please can you help me review the source file which I have you find here: https://github.com/Akinlabiajelabi/Flask-socketio-chat.git

Also, I would like to eventually connect the app to use Watson Conversation API to automate responses. I will be very glad if you can also help or point me in the right direction for that.

Thanks.

How to use SocketIO for updating progress of a large task?

Hi, I have a large multi user application on blue print which uses pandas and scikitlearn beneath. I would like to use SocketIO to update the user on the events happening on server like performing data cleansing, starting training, training ended, checking accuracy score etc.

Could some one please point me to a sample code for this?

Correct me if I'm wrong. I'm trying to establish a connection when the person clicks a button for training the model. This connection will remain open for a long time and as each stage is passed in server a notification is pushed to the user. There would be multiple users accessing the server at same time performing some heavy data analysis and machine learning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.