[英]Throwing errors with socket.io
I've created an Express app (with Angular) that uses socket.io for real-time communication.我创建了一个 Express 应用程序(使用 Angular),它使用 socket.io 进行实时通信。 How can I return an error from the server to the client within the
socket.on()
function?如何在
socket.on()
function 中从服务器向客户端返回错误?
Here's my code:这是我的代码:
io.on('connection', (socket: Socket) => {
socket.on('create game', () => {
if(condition) {
// Want to throw error here
}
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.