I'm trying to exchange data between websockets, following webchat tutorial and a old post.
The route that handles web socket connections is:
void getWS(scope WebSocket socket) {
logInfo("Web.getWS \t\tstart getWS");
auto t = runTask({
while (socket.connected) {
//....
socket.send(json);
//....
}
});
while (socket.waitForData) {
auto message = socket.receiveText();
if (message.length) {
logInfo("Web.waitForData \t\t%s", message);
} else {
logInfo("no data");
}
}
logInfo("Web.getWS \t\tdisconnected.");
}
It works, but if I reload the page (with ctrl-R in Firefox) the program exits with message:
Program exited with code -11
Here in github the complete project.
Where am'I wrong?
Thanks for your help.