Skip to content

Commit

Permalink
Merge pull request #148 from michaelhly/kevinheavey-patch-1
Browse files Browse the repository at this point in the history
fix README indentation
  • Loading branch information
kevinheavey authored Dec 2, 2021
2 parents 50ca0ce + d40bdf8 commit f38f01a
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 f38f01a

Please sign in to comment.