@@ -336,7 +336,7 @@ can be found in the `websockets connection`_ docs.
336
336
... logger.setLevel(logging.DEBUG )
337
337
... logger.addHandler(logging.StreamHandler())
338
338
339
- >> > async def context_manager_subscriptions_example ():
339
+ >> > async def context_manager_subscription_example ():
340
340
... # async with AsyncWeb3(AsyncIPCProvider("./path/to.filename.ipc") as w3: # for the AsyncIPCProvider
341
341
... async with AsyncWeb3(WebSocketProvider(f " ws://127.0.0.1:8546 " )) as w3: # for the WebSocketProvider
342
342
... # subscribe to new block headers
@@ -482,17 +482,6 @@ Interacting with the Persistent Connection
482
482
Examples on how to use this method can be seen above in the
483
483
`Using Persistent Connection Providers `_ section.
484
484
485
- .. py :method :: recv()
486
-
487
- The ``recv() `` method can be used to receive the next message from the
488
- socket. The response from this method is formatted by web3.py formatters
489
- and run through the middleware before being returned. This is not the
490
- recommended way to receive a message as the ``process_subscriptions() `` method
491
- is available for listening to subscriptions and the standard API for making
492
- requests via the appropriate module
493
- (e.g. ``block_num = await w3.eth.block_number ``) is available for receiving
494
- responses for one-to-one request-to-response calls.
495
-
496
485
.. py :method :: send(method: RPCEndpoint, params: Sequence[Any])
497
486
498
487
This method is available strictly for sending raw requests to the socket,
@@ -502,6 +491,25 @@ Interacting with the Persistent Connection
502
491
module. For example, use ``w3.eth.get_block("latest") `` instead of
503
492
``w3.socket.send("eth_getBlockByNumber", ["latest", True]) ``.
504
493
494
+ .. py :method :: recv()
495
+
496
+ The ``recv() `` method can be used to receive the next response for a request
497
+ from the socket. The response from this method is the raw response. This is not
498
+ the recommended way to receive a response for a request, as it is not formatted
499
+ by *web3.py * formatters or run through the middleware. Instead, use the methods
500
+ available on the respective web3 module
501
+ (e.g. ``block_num = await w3.eth.block_number ``) for retrieving responses for
502
+ one-to-one request-to-response calls.
503
+
504
+ .. py :method :: make_request(method: RPCEndpoint, params: Sequence[Any])
505
+
506
+ This method is available for making requests to the socket and retrieving the
507
+ response. It is not recommended to use this method directly, as the responses
508
+ will not be properly formatted by *web3.py * formatters or run through the
509
+ middleware. Instead, use the methods available on the respective web3 module.
510
+ For example, use ``w3.eth.get_block("latest") `` instead of
511
+ ``w3.socket.make_request("eth_getBlockByNumber", ["latest", True]) ``.
512
+
505
513
506
514
LegacyWebSocketProvider
507
515
~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments