Include subscription id in ds websocket updates
This commit is contained in:
1 parent
461f690463
commit
de9d47cd00
3 files changed
+20
-3
No files matched your search
@@ -94,8 +94,9 @@ const App = () => {
|
||||
} else if (msg.id != null) {
|
||||
setQueryState(msg.result.status);
|
||||
} else {
|
||||
console.info(`Received rows: ${msg.params.all}`);
|
||||
setBlueTable({columns: msg.params.columns, rows: msg.params.all});
|
||||
console.assert(msg.params.subscription_id == subscriptionId);
|
||||
console.info(`Received rows: ${msg.params.table.all}`);
|
||||
setBlueTable({columns: msg.params.table.columns, rows: msg.params.table.all});
|
||||
}
|
||||
};
|
||||
}, [getWebSocket, readyState]);
|
||||
|
||||
@@ -97,7 +97,10 @@ class DataStreamSubscription : IDisposable, IHostedService {
|
||||
IncludeCurrent = true,
|
||||
UseObjectRows = true,
|
||||
});
|
||||
var res = JsonRpcRequest.CreateNotification(method, dp);
|
||||
var res = JsonRpcRequest.CreateNotification(method, new DataStreamSubscriptionUpdate() {
|
||||
SubscriptionId = Id,
|
||||
Table = dp
|
||||
});
|
||||
var str = serialize(res, serializerOpts);
|
||||
if (str is null) {
|
||||
logger.LogError("Unsubscribing from stream early because we failed to serialize an outgoing DataPacket");
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Bts.DataStreamWebApp.Server;
|
||||
|
||||
using BCG;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class DataStreamSubscriptionUpdate {
|
||||
[JsonPropertyName("subscription_id")]
|
||||
public string? SubscriptionId { get; set; }
|
||||
|
||||
[JsonPropertyName("table")]
|
||||
public DataPacket? Table { get; set; }
|
||||
}
|
||||
Reference in new issue
Block a user