diff --git a/MIG/Gateways/WebSocketGateway.cs b/MIG/Gateways/WebSocketGateway.cs index e47fb52..0ea66dd 100644 --- a/MIG/Gateways/WebSocketGateway.cs +++ b/MIG/Gateways/WebSocketGateway.cs @@ -115,16 +115,22 @@ public void OnInterfacePropertyChanged(object sender, InterfacePropertyChangedEv WebSocketServiceHost host; webSocketServer.WebSocketServices.TryGetServiceHost("/events", out host); if (host == null) return; - - if (messagePack) + try { - //var lz4Options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray); - //byte[] eventBytes = MessagePackSerializer.Serialize(args.EventData, lz4Options); - host.Sessions.BroadcastAsync(MigService.Pack(args.EventData), () => {}); + if (messagePack) + { + //var lz4Options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray); + //byte[] eventBytes = MessagePackSerializer.Serialize(args.EventData, lz4Options); + host.Sessions.BroadcastAsync(MigService.Pack(args.EventData), () => { }); + } + else + { + host.Sessions.BroadcastAsync(MigService.JsonSerialize(args.EventData), () => { }); + } } - else + catch (Exception e) { - host.Sessions.BroadcastAsync(MigService.JsonSerialize(args.EventData), () => {}); + MigService.Log.Error(e); } } }