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
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 37
Download now
Download to read offline
Recommended
Puppeteer can automate that! - AmsterdamJS
Puppeteer can automate that! - AmsterdamJS
Önder Ceylan
Introduction to Firebase with Android and Beyond...
Introduction to Firebase with Android and Beyond...
Kasper Loevborg Jensen
Maven Overview
Maven Overview
FastConnect
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
MongoDB
Spring boot introduction
Spring boot introduction
Rasheed Waraich
Real Application Security (RAS) and Oracle Application Express (APEX)
Real Application Security (RAS) and Oracle Application Express (APEX)
Dimitri Gielis
Angular and The Case for RxJS
Angular and The Case for RxJS
Sandi Barr
How to Choose the Proper Infra (Online, Odoo.sh, On premise)
How to Choose the Proper Infra (Online, Odoo.sh, On premise)
Odoo
Recommended
Puppeteer can automate that! - AmsterdamJS
Puppeteer can automate that! - AmsterdamJS
Önder Ceylan
Introduction to Firebase with Android and Beyond...
Introduction to Firebase with Android and Beyond...
Kasper Loevborg Jensen
Maven Overview
Maven Overview
FastConnect
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
MongoDB
Spring boot introduction
Spring boot introduction
Rasheed Waraich
Real Application Security (RAS) and Oracle Application Express (APEX)
Real Application Security (RAS) and Oracle Application Express (APEX)
Dimitri Gielis
Angular and The Case for RxJS
Angular and The Case for RxJS
Sandi Barr
How to Choose the Proper Infra (Online, Odoo.sh, On premise)
How to Choose the Proper Infra (Online, Odoo.sh, On premise)
Odoo
Cypress
Cypress
Jonathan de Britto Sedrez
Odoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best Practices
Odoo
An Attacker's View of Serverless and GraphQL Apps - Abhay Bhargav - AppSec Ca...
An Attacker's View of Serverless and GraphQL Apps - Abhay Bhargav - AppSec Ca...
Abhay Bhargav
Open source APM Scouter로 모니터링 잘 하기
Open source APM Scouter로 모니터링 잘 하기
GunHee Lee
Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
Build RESTful API Using Express JS
Build RESTful API Using Express JS
Cakra Danu Sedayu
Web API(Dynamics 365 )勉強会
Web API(Dynamics 365 )勉強会
Kazuya Sugimoto
Spring cloud config
Spring cloud config
Shubhani Jain
Python/Django를 이용한 쇼핑몰 구축(2018 4월 Django Girls Seoul)
Python/Django를 이용한 쇼핑몰 구축(2018 4월 Django Girls Seoul)
Youngil Cho
Spring Boot Actuator
Spring Boot Actuator
Rowell Belen
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets Salesforce
Salesforce Developers
Introduction to Spring Boot
Introduction to Spring Boot
Trey Howard
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
Lyudmil Latinov
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
if kakao
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
Deepu K Sasidharan
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
Brian Swartzfager
Code instrumentation
Code instrumentation
Mennan Tekbir
How to Convert a Component Design into an MUI React Code
How to Convert a Component Design into an MUI React Code
WrapPixel
System Hardening Using Ansible
System Hardening Using Ansible
Sonatype
Spring Boot
Spring Boot
Pei-Tang Huang
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
Cypress
Cypress
Jonathan de Britto Sedrez
Odoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best Practices
Odoo
An Attacker's View of Serverless and GraphQL Apps - Abhay Bhargav - AppSec Ca...
An Attacker's View of Serverless and GraphQL Apps - Abhay Bhargav - AppSec Ca...
Abhay Bhargav
Open source APM Scouter로 모니터링 잘 하기
Open source APM Scouter로 모니터링 잘 하기
GunHee Lee
Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...
Edureka!
Build RESTful API Using Express JS
Build RESTful API Using Express JS
Cakra Danu Sedayu
Web API(Dynamics 365 )勉強会
Web API(Dynamics 365 )勉強会
Kazuya Sugimoto
Spring cloud config
Spring cloud config
Shubhani Jain
Python/Django를 이용한 쇼핑몰 구축(2018 4월 Django Girls Seoul)
Python/Django를 이용한 쇼핑몰 구축(2018 4월 Django Girls Seoul)
Youngil Cho
Spring Boot Actuator
Spring Boot Actuator
Rowell Belen
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets Salesforce
Salesforce Developers
Introduction to Spring Boot
Introduction to Spring Boot
Trey Howard
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
Lyudmil Latinov
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
if kakao
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
Deepu K Sasidharan
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
Brian Swartzfager
Code instrumentation
Code instrumentation
Mennan Tekbir
How to Convert a Component Design into an MUI React Code
How to Convert a Component Design into an MUI React Code
WrapPixel
System Hardening Using Ansible
System Hardening Using Ansible
Sonatype
Spring Boot
Spring Boot
Pei-Tang Huang
What's hot
(20)
Cypress
Cypress
Odoo's Test Framework - Learn Best Practices
Odoo's Test Framework - Learn Best Practices
An Attacker's View of Serverless and GraphQL Apps - Abhay Bhargav - AppSec Ca...
An Attacker's View of Serverless and GraphQL Apps - Abhay Bhargav - AppSec Ca...
Open source APM Scouter로 모니터링 잘 하기
Open source APM Scouter로 모니터링 잘 하기
Python Django tutorial | Getting Started With Django | Web Development With D...
Python Django tutorial | Getting Started With Django | Web Development With D...
Build RESTful API Using Express JS
Build RESTful API Using Express JS
Web API(Dynamics 365 )勉強会
Web API(Dynamics 365 )勉強会
Spring cloud config
Spring cloud config
Python/Django를 이용한 쇼핑몰 구축(2018 4월 Django Girls Seoul)
Python/Django를 이용한 쇼핑몰 구축(2018 4월 Django Girls Seoul)
Spring Boot Actuator
Spring Boot Actuator
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets Salesforce
Introduction to Spring Boot
Introduction to Spring Boot
QA Challenge Accepted 4.0 - Cypress vs. Selenium
QA Challenge Accepted 4.0 - Cypress vs. Selenium
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개
Easy Microservices with JHipster - Devoxx BE 2017
Easy Microservices with JHipster - Devoxx BE 2017
AngularJS $http Interceptors (Explanation and Examples)
AngularJS $http Interceptors (Explanation and Examples)
Code instrumentation
Code instrumentation
How to Convert a Component Design into an MUI React Code
How to Convert a Component Design into an MUI React Code
System Hardening Using Ansible
System Hardening Using Ansible
Spring Boot
Spring Boot
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
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Khem
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
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
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
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
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Pixlogix Infotech
Recently uploaded
(20)
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
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