This commit is contained in:
Andrew Kingston 2023-05-31 16:08:35 +01:00
parent a7c6298d1f
commit ffbbf04e86
5 changed files with 20 additions and 20 deletions

View File

@ -16,7 +16,10 @@ async function init() {
cacheClient = await new Client(utils.Databases.GENERIC_CACHE).init()
lockClient = await new Client(utils.Databases.LOCKS).init()
writethroughClient = await new Client(utils.Databases.WRITE_THROUGH).init()
socketClient = await new Client(utils.Databases.SOCKET_IO, utils.SelectableDatabase.SOCKET_IO).init()
socketClient = await new Client(
utils.Databases.SOCKET_IO,
utils.SelectableDatabase.SOCKET_IO
).init()
}
export async function shutdown() {
@ -80,4 +83,4 @@ export async function getSocketClient() {
await init()
}
return socketClient
}
}

View File

@ -62,7 +62,6 @@
stripeRows,
})
// Build up context
let context = {
API: API || createAPIClient(),

View File

@ -60,12 +60,10 @@ export default class BuilderSocket extends BaseSocket {
}
emitDatasourceUpdate(ctx: any, datasource: Datasource) {
this.io
.in(ctx.appId)
.emit(BuilderSocketEvents.DatasourceChange, {
id: datasource._id,
datasource,
})
this.io.in(ctx.appId).emit(BuilderSocketEvents.DatasourceChange, {
id: datasource._id,
datasource,
})
}
emitDatasourceDeletion(ctx: any, id: string) {

View File

@ -72,20 +72,20 @@ export const SocketEvents = {
UserUpdate: "UserUpdate",
UserDisconnect: "UserDisconnect",
GetUsers: "GetUsers",
Heartbeat: "Heartbeat"
Heartbeat: "Heartbeat",
}
export const GridSocketEvents = {
RowChange: "RowChange",
TableChange: "TableChange",
SelectTable: "SelectTable",
SelectCell: "SelectCell"
SelectCell: "SelectCell",
}
export const BuilderSocketEvents = {
SelectApp: "SelectApp",
TableChange: "TableChange",
DatasourceChange: "DatasourceChange"
DatasourceChange: "DatasourceChange",
}
export const SocketSessionTTL = 60
export const SocketSessionTTL = 60

View File

@ -1,8 +1,8 @@
export interface SocketSession {
_id: string,
email: string,
firstName?: string,
lastName?: string,
sessionId: string,
room?: string
}
_id: string
email: string
firstName?: string
lastName?: string
sessionId: string
room?: string
}