🐛 Fix websocket gateway

This commit is contained in:
2025-09-22 00:13:43 +08:00
parent 204640a759
commit d5a5721402
2 changed files with 15 additions and 9 deletions

View File

@@ -141,12 +141,17 @@ public class WebSocketService
try
{
var endpoint = packet.Endpoint.Replace("DysonNetwork.", "").ToLower();
await _nats.PublishAsync(WebSocketPacketEvent.SubjectPrefix + endpoint, new WebSocketPacketEvent
{
AccountId = Guid.Parse(currentUser.Id),
DeviceId = deviceId,
PacketBytes = packet.ToBytes()
});
await _nats.PublishAsync(
WebSocketPacketEvent.SubjectPrefix + endpoint,
GrpcTypeHelper
.ConvertObjectToByteString(new WebSocketPacketEvent
{
AccountId = Guid.Parse(currentUser.Id),
DeviceId = deviceId,
PacketBytes = packet.ToBytes()
}).ToBase64()
);
return;
}
catch (Exception ex)
{
@@ -165,4 +170,4 @@ public class WebSocketService
CancellationToken.None
);
}
}
}