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() cacheClient = await new Client(utils.Databases.GENERIC_CACHE).init()
lockClient = await new Client(utils.Databases.LOCKS).init() lockClient = await new Client(utils.Databases.LOCKS).init()
writethroughClient = await new Client(utils.Databases.WRITE_THROUGH).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() { export async function shutdown() {
@ -80,4 +83,4 @@ export async function getSocketClient() {
await init() await init()
} }
return socketClient return socketClient
} }

View File

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

View File

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

View File

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

View File

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