Giter Site home page Giter Site logo

jkbrzt / chat Goto Github PK

View Code? Open in Web Editor NEW
246.0 246.0 69.0 6 KB

A simple chat app created to experiment with Redis, Gevent, Flask & Server-Sent Events.

Home Page: https://twitter.com/jakubroztocil

Python 100.00%
experiment flask jakubroztocil python redis server-sent-events

chat's People

Contributors

jkbrzt avatar masklinn avatar squadran2003 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  avatar  avatar  avatar  avatar  avatar

chat's Issues

Unexpected first data

When opening a browser, I found there was a line showing "1", which should not be there.

And in event_stream() function the print shows the following first data:

{'pattern': None, 'type': 'subscribe', 'channel': 'chat', 'data': 1L}

I'm new to this, and wandering what the 1L data is for. From my point of view, it should be empty.

decode byte string

The byte string should be decoded to utf-8, on a side note, the README should mention that the redis server needs to be started before the app is run.

How are client connection closes handled?

I'm using this model in a simple web application using a naive in-memory publish subscribe model I wrote. It's been incredibly useful, however, I've noticed (and I think I saw the same behavior when using redis) that this loop continues to run well after the client has disconnected. Have you experience and/or resolved that issue?

I'm thinking if I can get a handle to the client's socket I should be able to do a non-blocking test to see if it's still connected and break.

Edit: I was incorrect. Closing issue.

some clarification request

@jakubroztocil would you please provide some explanation regarding running this app through gunicorn + gevent workers?
In particular I can not understand how we're able to perform non-pending request to /stream with EventSource('/stream')? (In case of running app with gevent.pywsgi.WSGIServer I'll receive pending request for /stream but with gunicorn+gevent worker - 200 OK)

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.