Skip to content

Commit a3f9a99

Browse files
author
Roberto De Ioris
authored
Update AsyncIOAndUnrealEngine.md
1 parent 34bbe25 commit a3f9a99

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tutorials/AsyncIOAndUnrealEngine.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,30 @@ asyncio.ensure_future(spawn_server('192.168.173.45', 8885))
183183

184184
## Redis pubsub
185185

186+
```python
187+
import asyncio
188+
import ue_asyncio
189+
import unreal_engine as ue
190+
import aioredis
191+
192+
for task in asyncio.Task.all_tasks():
193+
task.cancel()
194+
195+
async def wait_for_redis():
196+
redis = await aioredis.create_redis(('192.168.173.27', 6379))
197+
channel, = await redis.subscribe('foobar')
198+
ue.log('subscribed to redis queue, waiting for messages ...')
199+
while await channel.wait_message():
200+
msg = await channel.get()
201+
ue.log_warning(msg)
202+
redis.close()
203+
ue.log_warning('done with redis')
204+
205+
asyncio.ensure_future(wait_for_redis())
206+
```
207+
208+
## aiohttp
209+
186210
## asyncio in your actors
187211

188212
## Additional 'transient' loop engines

0 commit comments

Comments
 (0)