All asyncio and websocket documentation I have read states that packets must be sent using the await (or yield from) prefix syntax. I would like to be able to call a function to send, however, without such syntax. Is it possible to use such syntax?
await websocket.send(message)
websocket.send(message)
No, asynchronous code wouldn't work without await/yield from statement. That's how asynchrony in Python organized and there were reasons to do it.
You can use synchronous websocket client instead, but I don't advise you to do it: asynchronous app would work faster.
asyncio syntax might look uncomfortable at first sight, but when you'll practice a bit, you'll see that it only helps you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With