1307 connection transports using e.g. TCP sockets and speaking the raw |
1307 connection transports using e.g. TCP sockets and speaking the raw |
1308 framing protocol, there will be a single instance for the lifetime of |
1308 framing protocol, there will be a single instance for the lifetime of |
1309 the TCP socket. For transports where there are multiple discrete |
1309 the TCP socket. For transports where there are multiple discrete |
1310 interactions (say tunneled within in HTTP request), there will be a |
1310 interactions (say tunneled within in HTTP request), there will be a |
1311 separate instance for each distinct interaction. |
1311 separate instance for each distinct interaction. |
|
1312 |
|
1313 Consumers are expected to tell instances when events occur by calling |
|
1314 various methods. These methods return a 2-tuple describing any follow-up |
|
1315 action(s) to take. The first element is the name of an action to |
|
1316 perform. The second is a data structure (usually a dict) specific to |
|
1317 that action that contains more information. e.g. if the reactor wants |
|
1318 to send frames to the server, the data structure will contain a reference |
|
1319 to those frames. |
|
1320 |
|
1321 Valid actions that consumers can be instructed to take are: |
|
1322 |
|
1323 noop |
|
1324 Indicates no additional action is required. |
|
1325 |
|
1326 sendframes |
|
1327 Indicates that frames should be sent to the server. The ``framegen`` |
|
1328 key contains a generator of frames that should be sent. The reactor |
|
1329 assumes that all frames in this generator are sent to the server. |
|
1330 |
|
1331 error |
|
1332 Indicates that an error occurred. The ``message`` key contains an |
|
1333 error message describing the failure. |
|
1334 |
|
1335 responsedata |
|
1336 Indicates a response to a previously-issued command was received. |
|
1337 |
|
1338 The ``request`` key contains the ``commandrequest`` instance that |
|
1339 represents the request this data is for. |
|
1340 |
|
1341 The ``data`` key contains the decoded data from the server. |
|
1342 |
|
1343 ``expectmore`` and ``eos`` evaluate to True when more response data |
|
1344 is expected to follow or we're at the end of the response stream, |
|
1345 respectively. |
1312 """ |
1346 """ |
1313 def __init__(self, hasmultiplesend=False, buffersends=True): |
1347 def __init__(self, hasmultiplesend=False, buffersends=True): |
1314 """Create a new instance. |
1348 """Create a new instance. |
1315 |
1349 |
1316 ``hasmultiplesend`` indicates whether multiple sends are supported |
1350 ``hasmultiplesend`` indicates whether multiple sends are supported |