import vibe.d;
static this()
{
WebSocket[] client_list;
auto router = new UrlRouter;
router.get("/", handleWebSockets(delegate(WebSocket sock){
client_list ~= sock;
while( sock.connected ){
auto msg = sock.receive();
foreach(client; client_list) client.send(msg); //=>"ERROR: Operating on TcpConnection owned by a different fiber!"
}
}));
auto settings = new HttpServerSettings;
settings.port = 9998;
listenHttp(settings, router);
}
I found https://github.com/rejectedsoftware/vibe.d/issues/50
I want to call acquire(), but WebSocket class don't have acquire().
How do you think most simple websocket chat?