Fix ApplicationWebSocket behaviour on IOException

This commit is contained in:
Harald Wolff 2019-09-02 12:17:50 +02:00
parent 99cb425199
commit eeed531377

View file

@ -7,6 +7,7 @@ using ln.json;
using ln.logging; using ln.logging;
using ln.types.rpc; using ln.types.rpc;
using System.Linq; using System.Linq;
using System.IO;
namespace ln.application namespace ln.application
{ {
public class ApplicationWebSocket : WebsocketResource public class ApplicationWebSocket : WebsocketResource
@ -48,6 +49,7 @@ namespace ln.application
currentWebSockets.Add(webSocket); currentWebSockets.Add(webSocket);
break; break;
case WSREvent.CLOSE: case WSREvent.CLOSE:
case WSREvent.ERROR:
currentWebSockets.Remove(webSocket); currentWebSockets.Remove(webSocket);
break; break;
} }
@ -63,8 +65,13 @@ namespace ln.application
{ {
foreach (WebSocket webSocket in CurrentWebSockets) foreach (WebSocket webSocket in CurrentWebSockets)
{ {
webSocket.Send(text); try
} {
webSocket.Send(text);
}
catch (IOException)
{ }
}
} }
public override void MessageReceived(WebSocketResourceRequestContext requestContext, string textMessage) public override void MessageReceived(WebSocketResourceRequestContext requestContext, string textMessage)