Submit Search
Upload
Flask With Server-Sent Event
•
2 likes
•
4,425 views
Tencent
Follow
Flask With Server-Sent Event by cppgohan sztechparty 20130317
Read less
Read more
Technology
Report
Share
Report
Share
1 of 37
Download now
Download to read offline
Recommended
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Edureka!
Flask Basics
Flask Basics
Eueung Mulyana
Web develop in flask
Web develop in flask
Jim Yeh
Jwt == insecurity?
Jwt == insecurity?
snyff
Type of DDoS attacks with hping3 example
Type of DDoS attacks with hping3 example
Himani Singh
Let's read code: the python-requests library
Let's read code: the python-requests library
Susan Tan
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Paige Bailey
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
Sébastien Saunier
Recommended
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Python Flask Tutorial For Beginners | Flask Web Development Tutorial | Python...
Edureka!
Flask Basics
Flask Basics
Eueung Mulyana
Web develop in flask
Web develop in flask
Jim Yeh
Jwt == insecurity?
Jwt == insecurity?
snyff
Type of DDoS attacks with hping3 example
Type of DDoS attacks with hping3 example
Himani Singh
Let's read code: the python-requests library
Let's read code: the python-requests library
Susan Tan
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Paige Bailey
Le Wagon - Javascript for Beginners
Le Wagon - Javascript for Beginners
Sébastien Saunier
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
Venkateswara Babu Ravipati
Flask & Flask-restx
Flask & Flask-restx
ammaraslam18
Laravel でやってみるクリーンアーキテクチャ #phpconfuk
Laravel でやってみるクリーンアーキテクチャ #phpconfuk
Shohei Okada
Flask – Python
Flask – Python
Max Claus Nunes
MongoDB: How it Works
MongoDB: How it Works
Mike Dirolf
Building Advanced XSS Vectors
Building Advanced XSS Vectors
Rodolfo Assis (Brute)
FIWARE Wednesday Webinars - Integrating FIWARE with Blockchain/DLTs
FIWARE Wednesday Webinars - Integrating FIWARE with Blockchain/DLTs
FIWARE
Techical Workflow for a Startup
Techical Workflow for a Startup
Sébastien Saunier
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Masoud Kalali
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile web
Dr. Ahmed Al Zaidy
Web Services PHP Tutorial
Web Services PHP Tutorial
Lorna Mitchell
WordPressプラグイン作成入門
WordPressプラグイン作成入門
Yuji Nojima
A python web service
A python web service
Temian Vlad
Why rust?
Why rust?
Mats Kindahl
JWT: jku x5u
JWT: jku x5u
snyff
Node.js File system & Streams
Node.js File system & Streams
Eyal Vardi
Rate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX Plus
NGINX, Inc.
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
Orange Tsai
검색엔진이 데이터를 다루는 법 김종민
검색엔진이 데이터를 다루는 법 김종민
종민 김
Introduction to python requests
Introduction to python requests
Abhijeet Kasurde
Server Side Swift
Server Side Swift
Chad Moone
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
Haehnchen
More Related Content
What's hot
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
Venkateswara Babu Ravipati
Flask & Flask-restx
Flask & Flask-restx
ammaraslam18
Laravel でやってみるクリーンアーキテクチャ #phpconfuk
Laravel でやってみるクリーンアーキテクチャ #phpconfuk
Shohei Okada
Flask – Python
Flask – Python
Max Claus Nunes
MongoDB: How it Works
MongoDB: How it Works
Mike Dirolf
Building Advanced XSS Vectors
Building Advanced XSS Vectors
Rodolfo Assis (Brute)
FIWARE Wednesday Webinars - Integrating FIWARE with Blockchain/DLTs
FIWARE Wednesday Webinars - Integrating FIWARE with Blockchain/DLTs
FIWARE
Techical Workflow for a Startup
Techical Workflow for a Startup
Sébastien Saunier
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Masoud Kalali
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile web
Dr. Ahmed Al Zaidy
Web Services PHP Tutorial
Web Services PHP Tutorial
Lorna Mitchell
WordPressプラグイン作成入門
WordPressプラグイン作成入門
Yuji Nojima
A python web service
A python web service
Temian Vlad
Why rust?
Why rust?
Mats Kindahl
JWT: jku x5u
JWT: jku x5u
snyff
Node.js File system & Streams
Node.js File system & Streams
Eyal Vardi
Rate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX Plus
NGINX, Inc.
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
Orange Tsai
검색엔진이 데이터를 다루는 법 김종민
검색엔진이 데이터를 다루는 법 김종민
종민 김
Introduction to python requests
Introduction to python requests
Abhijeet Kasurde
What's hot
(20)
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
Flask & Flask-restx
Flask & Flask-restx
Laravel でやってみるクリーンアーキテクチャ #phpconfuk
Laravel でやってみるクリーンアーキテクチャ #phpconfuk
Flask – Python
Flask – Python
MongoDB: How it Works
MongoDB: How it Works
Building Advanced XSS Vectors
Building Advanced XSS Vectors
FIWARE Wednesday Webinars - Integrating FIWARE with Blockchain/DLTs
FIWARE Wednesday Webinars - Integrating FIWARE with Blockchain/DLTs
Techical Workflow for a Startup
Techical Workflow for a Startup
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Server Sent Events, Async Servlet, Web Sockets and JSON; born to work together!
Chapter 5 Designing for the mobile web
Chapter 5 Designing for the mobile web
Web Services PHP Tutorial
Web Services PHP Tutorial
WordPressプラグイン作成入門
WordPressプラグイン作成入門
A python web service
A python web service
Why rust?
Why rust?
JWT: jku x5u
JWT: jku x5u
Node.js File system & Streams
Node.js File system & Streams
Rate Limiting with NGINX and NGINX Plus
Rate Limiting with NGINX and NGINX Plus
Security in PHP - 那些在滲透測試的小技巧
Security in PHP - 那些在滲透測試的小技巧
검색엔진이 데이터를 다루는 법 김종민
검색엔진이 데이터를 다루는 법 김종민
Introduction to python requests
Introduction to python requests
Similar to Flask With Server-Sent Event
Server Side Swift
Server Side Swift
Chad Moone
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
Haehnchen
One commit, one release. Continuously delivering a Symfony project.
One commit, one release. Continuously delivering a Symfony project.
Javier López
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
coreygoldberg
OpenFaaS JeffConf 2017 - Milan
OpenFaaS JeffConf 2017 - Milan
Alex Ellis
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Fabrice Bernhard
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
Niklas Heidloff
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
Joe Ferguson
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CI
Bruno Rocha
Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011
Tatsuhiko Miyagawa
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
Combell NV
The Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
OpenFaaS KubeCon Zero to Serverless in 60 seconds anywhere
OpenFaaS KubeCon Zero to Serverless in 60 seconds anywhere
Alex Ellis
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
Ruben Tan
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
LINE Corporation
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Pantheon
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
Fwdays
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
Joe Ferguson
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
Amazon Web Services Japan
Similar to Flask With Server-Sent Event
(20)
Server Side Swift
Server Side Swift
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
One commit, one release. Continuously delivering a Symfony project.
One commit, one release. Continuously delivering a Symfony project.
Performance and Scalability Testing with Python and Multi-Mechanize
Performance and Scalability Testing with Python and Multi-Mechanize
OpenFaaS JeffConf 2017 - Milan
OpenFaaS JeffConf 2017 - Milan
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CI
Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
The Modern Developer Toolbox
The Modern Developer Toolbox
OpenFaaS KubeCon Zero to Serverless in 60 seconds anywhere
OpenFaaS KubeCon Zero to Serverless in 60 seconds anywhere
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
Kubernetes上で動作する機械学習モジュールの配信&管理基盤Rekcurd について
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
More from Tencent
Viny storage—网络游戏数据存储的终极解决方案
Viny storage—网络游戏数据存储的终极解决方案
Tencent
Hxhsm——取代mvc的状态机框架
Hxhsm——取代mvc的状态机框架
Tencent
Web开发人员之路
Web开发人员之路
Tencent
Qt 基础
Qt 基础
Tencent
Twitter bootstrap2.0 taste
Twitter bootstrap2.0 taste
Tencent
Meteor
Meteor
Tencent
Introduction to hubot
Introduction to hubot
Tencent
More from Tencent
(7)
Viny storage—网络游戏数据存储的终极解决方案
Viny storage—网络游戏数据存储的终极解决方案
Hxhsm——取代mvc的状态机框架
Hxhsm——取代mvc的状态机框架
Web开发人员之路
Web开发人员之路
Qt 基础
Qt 基础
Twitter bootstrap2.0 taste
Twitter bootstrap2.0 taste
Meteor
Meteor
Introduction to hubot
Introduction to hubot
Recently uploaded
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
ThousandEyes
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
soniya singh
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
BookNet Canada
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Alan Dix
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
Scott Keck-Warren
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Paola De la Torre
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
Recently uploaded
(20)
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Flask With Server-Sent Event
1.
with Server-Sent Events
@cppgohan
2.
Flask?
3.
Flask? MicroFramework again...
4.
Flask? MicroFramework again... Written in
Python
5.
=
6.
=
7.
= Werkzeug WSGI utility library
8.
=
+ Werkzeug WSGI utility library
9.
=
+ Werkzeug WSGI utility library
10.
=
+ Werkzeug Jinja2 WSGI utility library template engine
11.
Demo Hello.py
12.
Demo Hello.py
13.
Demo Hello.py
14.
Demo index.html
15.
Demo index.html result???
16.
Demo index.html result??? •
terminal run: python hello.py • open http://localhost:5000
17.
Server-Sent Event server push的html5标准,
用法简易, 单次连接比polling高效些. 相比websocket的双向二进制数据, Server-Sent Event只是单向, HTTP协议. (但浏览器调试工具往往没法看到服务器发来的数据, X_X) Server对Client的请求, 做stream方式的响应.
18.
Server-Sent Event
19.
Server-Sent Event
支 持 率 不 要 能 高, 暂 兼 ”玩” 时 容 只 处 理
20.
Demo index.html
21.
Demo hello.py
22.
Demo redis:
23.
Demo redis:
demo:FILE_TEXT -- 每次python读出来的文本 demo:FILE_TEXT_SEQ -- 为文本版本号, 每次文本更新, 版本号+1 /sever_push响应 -- 当FILE_TEXT_SEQ增加时, 将最新的文本返回给浏览器
24.
Demo result???
25.
Demo result??? •
terminal run: python hello.py
26.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000
27.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000 • block!!!
28.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000 • block!!! solution???
29.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000 • block!!! solution??? • async WSGI server! (eg. gunicorn + gevent, gevent)
30.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000 • block!!! solution??? • async WSGI server! (eg.-kgunicorn-bgevent, gevent)hello:app + • terminal run: gunicorn gevent '0.0.0.0:5000'
31.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000 • block!!! solution??? • async WSGI server! (eg.-kgunicorn-bgevent, gevent)hello:app + • terminal run: gunicorn gevent '0.0.0.0:5000' • open http://localhost:5000
32.
Demo result??? •
terminal run: python hello.py • open http://localhost:5000 • block!!! solution??? • async WSGI server! (eg.-kgunicorn-bgevent, gevent)hello:app + • terminal run: gunicorn gevent '0.0.0.0:5000' • open http://localhost:5000 again! • open http://localhost:5000
33.
More Demo Server下发代码示例
34.
More Demo Server下发代码示例 • start
http://localhost:5000 web server • open push js script... • server excute js script... • browser • ...
35.
More Usage • 网站动态更新 •
区分客户端推送 • 微博墙实现 • webgame服务器推送 • 浏览器插件
36.
Resources • http://www.python.org/dev/peps/pep-0333/ • http://werkzeug.pocoo.org/ •
http://jinja.pocoo.org/ • http://flask.pocoo.org/ • http://www.gevent.org/ • http://gunicorn.org/ • http://dev.w3.org/html5/eventsource/ • http://www.html5rocks.com/en/tutorials/eventsource/basics/ • http://www.w3schools.com/html/html5_serversentevents.asp
37.
END; 2013, 分享不止!
Download now