Pycon Ireland 2017:WebSocket和Flask带来的乐趣-Miguel Grinberg



WebSocket使Web服务器可以与客户端建立专用连接,原始数据可以在任何时间,任何方向流动,而无需请求/响应周期和HTTP协议的“个性”。与Socket.IO等高级协议配合使用,您将获得功能强大且易于使用的双向低延迟通信框架,并且客户端可用于Python,JavaScript,Java,iOS,Android,C ++ 、. Net和更多。 Flask是用于Python的轻量级且非常流行的Web框架,它使编写Web服务器变得简单而有趣,而不会牺牲任何功能。将WebSocket,Socket.IO和Flask结合使用会发生什么?在本演讲中,我将向您展示将这些技术结合使用时可以构建的一些很酷的应用程序,包括流音频和视频,实时传感器数据,自动投票等等!

#WebSocket #Flask。

3 comments
  1. 1:53 what is websocket
    http limited to request/response interacation
    4:20 socket.io protocol
    !1 that is built on top of pure websocket and HTTP
    !2 socket.io can switch to HTTP long polling( for dummy IE )
    !3 you can think of socket.io as a way for the server code to invoke a function in the client, or the client calling a fuction in the server .
    you write a function on one side and other side can call it.
    !4 "invoke event" is equal to call fucntion
    7:36 socket.IO and python
    !1 server side :python-socketio
    client side :socketio-client
    9:17 webSocket and async
    !1 flask is not support async
    !2 WSGI apps must run on evenlet or gevent to get an async wrapper
    !3 9:42 HOW webservers work?

    11:20 examples on https://github.com/miguelgrinberg/socketio-examples

    12:18 example #1 chat
    !1 in server side, create the functions that the client will invoke (with emit function)
    16:31 example #2 Audio streaming(client streaming to the server)

    21:54 example #3 file uploading
    ! we have functions on the server, functions on the client
    26:41 example #4 live polls
    32:36 example #5 where do you live

Comments are closed.