websockets Documentation
Release 4.0") asyncio.get_event_loop().run_until_complete( hello('ws://localhost:8765')) And here’s an echo server: #!/usr/bin/env python import asyncio import websockets async def echo(websocket, path): async Basic example This section assumes Python 3.5. For older versions, read below. Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env format(greeting)) start_server = websockets.serve(hello, 'localhost', 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() On the server side, the handler coroutine0 码力 | 48 页 | 224.70 KB | 1 年前3
websockets Documentation
Release 5.0") asyncio.get_event_loop().run_until_complete( hello('ws://localhost:8765')) And here’s an echo server: #!/usr/bin/env python import asyncio import websockets async def echo(websocket, path): async Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. 3 websockets Documentation, Release 5.0 #!/usr/bin/env python # WS server example import {greeting}") start_server = websockets.serve(hello, 'localhost', 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() On the server side, websockets executes0 码力 | 56 页 | 245.43 KB | 1 年前3
websockets Documentation
Release 9.0here’s an echo server: #!/usr/bin/env python import asyncio import websockets async def echo(websocket, path): async for message in websocket: await websocket.send(message) start_server = websockets websockets.serve(echo, "localhost", 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() Do you like it? Let’s dive in! CONTENTS 1 websockets Documentation 3 Basic example Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python # WS server example import asyncio import websockets0 码力 | 81 页 | 352.88 KB | 1 年前3
websockets Documentation
Release 6.0") asyncio.get_event_loop().run_until_complete( hello('ws://localhost:8765')) And here’s an echo server: #!/usr/bin/env python import asyncio import websockets async def echo(websocket, path): async Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. 3 websockets Documentation, Release 6.0 #!/usr/bin/env python # WS server example import {greeting}") start_server = websockets.serve(hello, 'localhost', 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() On the server side, websockets executes0 码力 | 58 页 | 253.08 KB | 1 年前3
websockets Documentation
Release 3.4Basic example This section assumes Python 3.5. For older versions, read below. Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env send(greeting) print("> {}".format(greeting)) start_server = websockets.serve(hello, 'localhost', 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() 7 websockets websockets Documentation, Release 3.4 On the server side, the handler coroutine hello is executed once for each WebSocket connection. The connection is automatically closed when the handler returns. Here’s0 码力 | 36 页 | 192.66 KB | 1 年前3
Tornado 6.5 Documentationwhich is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While it is possible to use the Tornado HTTP server as a container for other WSGI frameworks (WSGIContainer) framework and HTTP server together. 6.1.2 Asynchronous and non-Blocking I/O Real-time web features require a long-lived mostly-idle connection per user. In a traditional synchronous web server, this implies0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.4 Documentation
which is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While it is possible to use the Tornado HTTP server as a container for other WSGI frameworks (WSGIContainer) framework and HTTP server together. 6.1.2 Asynchronous and non-Blocking I/O Real-time web features require a long-lived mostly-idle connection per user. In a traditional synchronous web server, this implies0 码力 | 268 页 | 1.09 MB | 1 年前3
Tornado 6.2 Documentation
which is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While it is possible to use the Tornado HTTP server as a container for other WSGI frameworks (WSGIContainer) framework and HTTP server together. 6.1.2 Asynchronous and non-Blocking I/O Real-time web features require a long-lived mostly-idle connection per user. In a traditional synchronous web server, this implies0 码力 | 260 页 | 1.06 MB | 1 年前3
Tornado 6.4 Documentation
which is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While it is possible to use the Tornado HTTP server as a container for other WSGI frameworks (WSGIContainer) framework and HTTP server together. 6.1.2 Asynchronous and non-Blocking I/O Real-time web features require a long-lived mostly-idle connection per user. In a traditional synchronous web server, this implies0 码力 | 268 页 | 1.09 MB | 1 年前3
Tornado 6.4 Documentation
which is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking library including protocols. The Tornado web framework and HTTP server together offer a full-stack alternative to WSGI. While it is possible to use the Tornado HTTP server as a container for other WSGI frameworks (WSGIContainer) framework and HTTP server together. 6.1.2 Asynchronous and non-Blocking I/O Real-time web features require a long-lived mostly-idle connection per user. In a traditional synchronous web server, this implies0 码力 | 268 页 | 1.09 MB | 1 年前3
共 535 条
- 1
- 2
- 3
- 4
- 5
- 6
- 54













