websockets Documentation Release 9.0
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 websockets async def hello(websocket server side, websockets executes the handler coroutine hello once for each WebSocket connection. It closes the connection when the handler coroutine returns. Here’s a corresponding WebSocket client example get_event_loop().run_until_complete(hello()) Using connect() as an asynchronous context manager ensures the connection is closed before exiting the hello coroutine. 1.1.4 Secure example Secure WebSocket connections0 码力 | 81 页 | 352.88 KB | 1 年前3websockets Documentation Release 5.0
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 server side, websockets executes the handler coroutine hello once for each WebSocket connection. It closes the connection when the handler coroutine returns. Here’s a corresponding WebSocket client example get_event_loop().run_until_complete(hello()) Using connect() as an asynchronous context manager ensures the connection is closed before exiting the hello coroutine. 1.1.4 Secure example Secure WebSocket connections0 码力 | 56 页 | 245.43 KB | 1 年前3websockets Documentation Release 6.0
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 server side, websockets executes the handler coroutine hello once for each WebSocket connection. It closes the connection when the handler coroutine returns. Here’s a corresponding WebSocket client example get_event_loop().run_until_complete(hello()) Using connect() as an asynchronous context manager ensures the connection is closed before exiting the hello coroutine. 1.1.4 Secure example Secure WebSocket connections0 码力 | 58 页 | 253.08 KB | 1 年前3websockets Documentation Release 4.0
Here’s a WebSocket server example. It reads a name from the client, sends a greeting, and closes the connection. #!/usr/bin/env python import asyncio import websockets async def hello(websocket, path): name run_forever() 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’s a corresponding client example 1.4 Common patterns You will usually want to process several messages during the lifetime of a connection. Therefore you must write a loop. Here are the basic patterns for building a WebSocket server.0 码力 | 48 页 | 224.70 KB | 1 年前3Celery v5.0.1 Documentation
return 'hello world' Highly Available Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication scheme are optional, and will default to localhost on port 6379, using database 0. If a Unix socket connection should be used, the URL needs to be in the format: redis+socket:///path/to/redis.sock Specifying setting: app.conf.result_backend_transport_options = {'master_name': "mymaster"} Connection timeouts To configure the connection timeouts for the Redis result backend, use the retry_policy key under resul0 码力 | 2313 页 | 2.13 MB | 1 年前3Celery v5.0.2 Documentation
return 'hello world' Highly Available Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication scheme are optional, and will default to localhost on port 6379, using database 0. If a Unix socket connection should be used, the URL needs to be in the format: redis+socket:///path/to/redis.sock Specifying setting: app.conf.result_backend_transport_options = {'master_name': "mymaster"} Connection timeouts To configure the connection timeouts for the Redis result backend, use the retry_policy key under resul0 码力 | 2313 页 | 2.14 MB | 1 年前3Celery v5.0.0 Documentation
return 'hello world' Highly Available Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication scheme are optional, and will default to localhost on port 6379, using database 0. If a Unix socket connection should be used, the URL needs to be in the format: redis+socket:///path/to/redis.sock Specifying setting: app.conf.result_backend_transport_options = {'master_name': "mymaster"} Connection timeouts To configure the connection timeouts for the Redis result backend, use the retry_policy key under resul0 码力 | 2309 页 | 2.13 MB | 1 年前3Celery v5.0.5 Documentation
return 'hello world' Highly Available Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication scheme are optional, and will default to localhost on port 6379, using database 0. If a Unix socket connection should be used, the URL needs to be in the format: redis+socket:///path/to/redis.sock Specifying setting: app.conf.result_backend_transport_options = {'master_name': "mymaster"} Connection timeouts To configure the connection timeouts for the Redis result backend, use the retry_policy key under resul0 码力 | 2315 页 | 2.14 MB | 1 年前3Celery 3.0 Documentation
return 'hello world' Highly Available Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication scheme are optional, and will default to localhost on port 6379, using database 0. If a Unix socket connection should be used, the URL needs to be in the format: redis+socket:///path/to/redis.sock Specifying This can also be useful to cache resources, For example, a base Task class that caches a database connection: from celery import Task class DatabaseTask(Task): _db = None @property def db(self):0 码力 | 2110 页 | 2.23 MB | 1 年前3Celery v4.0.0 Documentation
return 'hello world' Highly Available Workers and clients will automatically retry in the event of connection loss or failure, and some brokers support HA in way of Primary/Primary or Primary/Replica replication scheme are optional, and will default to localhost on port 6379, using database 0. If a Unix socket connection should be used, the URL needs to be in the format: redis+socket:///path/to/redis.sock Specifying This can also be useful to cache resources, For example, a base Task class that caches a database connection: from celery import Task class DatabaseTask(Task): _db = None @property def db(self):0 码力 | 2106 页 | 2.23 MB | 1 年前3
共 464 条
- 1
- 2
- 3
- 4
- 5
- 6
- 47