mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-09 15:08:12 -05:00
fix(postgres-emitter): use parameterized query to send the NOTIFY command
Related: - https://github.com/socketio/socket.io-postgres-emitter/issues/1 - https://github.com/socketio/socket.io-postgres-adapter/pull/1
This commit is contained in:
@@ -380,9 +380,10 @@ export class BroadcastOperator<
|
||||
document.type,
|
||||
this.emitter.channel,
|
||||
);
|
||||
await this.emitter.pool.query(
|
||||
`NOTIFY "${this.emitter.channel}", '${payload}'`,
|
||||
);
|
||||
await this.emitter.pool.query("SELECT pg_notify($1, $2)", [
|
||||
this.emitter.channel,
|
||||
payload,
|
||||
]);
|
||||
} catch (err) {
|
||||
// @ts-ignore
|
||||
this.emit("error", err);
|
||||
@@ -407,9 +408,10 @@ export class BroadcastOperator<
|
||||
type: document.type,
|
||||
attachmentId,
|
||||
});
|
||||
this.emitter.pool.query(
|
||||
`NOTIFY "${this.emitter.channel}", '${headerPayload}'`,
|
||||
);
|
||||
await this.emitter.pool.query("SELECT pg_notify($1, $2)", [
|
||||
this.emitter.channel,
|
||||
headerPayload,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user