Skip to content

Commit

Permalink
Store emit response and return later from bridge (#3456)
Browse files Browse the repository at this point in the history
Store response and return later
  • Loading branch information
oguzhankoral authored May 30, 2024
1 parent ca5922c commit 040373f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DUI3-DX/DUI3/Speckle.Connectors.DUI/Bridge/BrowserBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ public void Send<T>(string eventName, T data)
where T : class
{
string payload = JsonConvert.SerializeObject(data, _serializerOptions);
var script = $"{FrontendBoundName}.emit('{eventName}', '{payload}')";

string requestId = $"{Guid.NewGuid()}_{eventName}";
_resultsStore[requestId] = payload;
var script = $"{FrontendBoundName}.emitResponseReady('{eventName}', '{requestId}')";
_scriptMethod.NotNull().Invoke(script);
}
}

0 comments on commit 040373f

Please sign in to comment.