Skip to content

Commit

Permalink
Set correct api features
Browse files Browse the repository at this point in the history
  • Loading branch information
myieye committed Jun 13, 2024
1 parent 638b29c commit 19cd4c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion frontend/viewer/src/CrdtProjectView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
.catch(err => console.error(err));
onDestroy(() => connection.stop());
setContext('project-name', projectName);
SetupSignalR(connection);
SetupSignalR(connection, {
history: true,
write: true,
});
let connected = false;
</script>
<ProjectView {projectName} isConnected={connected}></ProjectView>
7 changes: 5 additions & 2 deletions frontend/viewer/src/FwDataProjectView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
.catch(err => console.error(err));
onDestroy(() => connection.stop());
setContext('project-name', projectName);
SetupSignalR(connection);
SetupSignalR(connection, {
history: false,
write: true,
});
let connected = false;
</script>
<ProjectView isConnected={connected}></ProjectView>
<ProjectView {projectName} isConnected={connected}></ProjectView>
7 changes: 2 additions & 5 deletions frontend/viewer/src/lib/services/service-provider-signalr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import type { HubConnection } from '@microsoft/signalr';
import type { LexboxApiFeatures, LexboxApiMetadata } from './lexbox-api';
import {LexboxService} from './service-provider';

export function SetupSignalR(connection: HubConnection) {
export function SetupSignalR(connection: HubConnection, features: LexboxApiFeatures) {
const hubFactory = getHubProxyFactory('ILexboxApiHub');
const hubProxy = hubFactory.createHubProxy(connection);

const lexboxApiHubProxy = Object.assign(hubProxy, {
SupportedFeatures(): LexboxApiFeatures {
return {
history: true,
write: true,
};
return features;
}
} satisfies LexboxApiMetadata);
getReceiverRegister('ILexboxClient').register(connection, {
Expand Down

0 comments on commit 19cd4c9

Please sign in to comment.