feat(server): cleanup gateway code (#6118)

This commit is contained in:
liuyi
2024-03-15 02:00:40 +00:00
parent 79ffca314d
commit 533c181640
5 changed files with 156 additions and 164 deletions

View File

@@ -104,7 +104,7 @@ export class AffineCloudAwarenessProvider implements AwarenessProvider {
uint8ArrayToBase64(awarenessUpdate)
.then(encodedAwarenessUpdate => {
this.socket.emit('awareness-update', {
guid: this.workspaceId,
workspaceId: this.workspaceId,
awarenessUpdate: encodedAwarenessUpdate,
});
})
@@ -120,11 +120,19 @@ export class AffineCloudAwarenessProvider implements AwarenessProvider {
};
handleConnect = () => {
this.socket.emit('client-handshake-awareness', {
workspaceId: this.workspaceId,
version: runtimeConfig.appVersion,
});
this.socket.emit('awareness-init', this.workspaceId);
this.socket.emit(
'client-handshake-awareness',
{
workspaceId: this.workspaceId,
version: runtimeConfig.appVersion,
},
(res: any) => {
logger.debug('awareness handshake finished', res);
this.socket.emit('awareness-init', this.workspaceId, (res: any) => {
logger.debug('awareness-init finished', res);
});
}
);
};
handleReject = (_msg: RejectByVersion) => {

View File

@@ -42,10 +42,16 @@ export class AffineSyncStorage implements SyncStorage {
}
handleConnect = () => {
this.socket.emit('client-handshake-sync', {
workspaceId: this.workspaceId,
version: runtimeConfig.appVersion,
});
this.socket.emit(
'client-handshake-sync',
{
workspaceId: this.workspaceId,
version: runtimeConfig.appVersion,
},
(res: any) => {
logger.debug('client handshake finished', res);
}
);
};
handleReject = (message: RejectByVersion) => {