Skip to content

Commit

Permalink
fix README indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey authored Dec 2, 2021
1 parent 50ca0ce commit d40bdf8
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,31 @@ asyncio.run(main())
### Websockets Client

```py
import asyncio
from asyncstdlib import enumerate
from solana.rpc.websocket_api import connect

async def main():
async with connect("ws://api.devnet.solana.com") as websocket:
await websocket.logs_subscribe()
first_resp = await websocket.recv()
subscription_id = first_resp.result
next_resp = await websocket.recv()
print(next_resp)
await websocket.logs_unsubscribe(subscription_id)

# Alternatively, use the client as an infinite asynchronous iterator:
async with connect("ws://api.devnet.solana.com") as websocket:
await websocket.logs_subscribe()
first_resp = await websocket.recv()
subscription_id = first_resp.result
async for idx, msg in enumerate(websocket):
if idx == 3:
break
print(msg)
await websocket.logs_unsubscribe(subscription_id)

asyncio.run(main())
import asyncio
from asyncstdlib import enumerate
from solana.rpc.websocket_api import connect

async def main():
async with connect("ws://api.devnet.solana.com") as websocket:
await websocket.logs_subscribe()
first_resp = await websocket.recv()
subscription_id = first_resp.result
next_resp = await websocket.recv()
print(next_resp)
await websocket.logs_unsubscribe(subscription_id)

# Alternatively, use the client as an infinite asynchronous iterator:
async with connect("ws://api.devnet.solana.com") as websocket:
await websocket.logs_subscribe()
first_resp = await websocket.recv()
subscription_id = first_resp.result
async for idx, msg in enumerate(websocket):
if idx == 3:
break
print(msg)
await websocket.logs_unsubscribe(subscription_id)

asyncio.run(main())
```

## Development
Expand Down

0 comments on commit d40bdf8

Please sign in to comment.