New issue
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
WebSocketServer无法从外部指定loop吗 #525
Comments
HttpServer/WebSocketServer不支持传入外部loop,不过你可以在HttpServer的onWorkerStart回调里通过currentThreadEventLoop获取到当前线程的loop |
也就是说, 如果想同时创建N个不同Server, 无论如何也不能只用一个loop以及只用一个thread 这多少增加了开发者在线程安全方面的负担 |
TcpServer类或者更底层的hloop是支持使用同一个loop的,你可以先创建WebSocketServer,然后在onWorkerStart里通过currentThreadEventLoop获取到当前线程的loop,然后再去使用这一个loop。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
看起来WebSocketServer/HttpServer/其他Server, 无法使用外部传入的loop
那么每创建N个服务, 都要创建N个新loop, 和N*M个线程
The text was updated successfully, but these errors were encountered: