We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to integrate socket.io with koa v2. Can I pass a async funtion as a event on server side, just like:
socket.on('message', async () => { const some1 = await fun1() const some2 = await fun2() socket.emit('reply', some1, some2) ... })
As I known, the async funtion just a wrapper of promise. Is there any implicit problems?
The text was updated successfully, but these errors were encountered:
That works just fine. In case fun1 or fun2 can throw, you might want to add try/catch
fun1
fun2
try/catch
Sorry, something went wrong.
thx a lot : )
For anyone coming via Google, please be aware of this critical issue using await and socket.io:
await
#3431
No branches or pull requests
I'm trying to integrate socket.io with koa v2.
Can I pass a async funtion as a event on server side,
just like:
As I known, the async funtion just a wrapper of promise.
Is there any implicit problems?
The text was updated successfully, but these errors were encountered: