11import { Adapter , BroadcastOptions , Room } from "socket.io-adapter" ;
22import { randomBytes } from "crypto" ;
33import { encode , decode } from "@msgpack/msgpack" ;
4+ import { Pool } from "pg" ;
45
56const randomId = ( ) => randomBytes ( 8 ) . toString ( "hex" ) ;
67const debug = require ( "debug" ) ( "socket.io-postgres-adapter" ) ;
@@ -118,7 +119,7 @@ export interface PostgresAdapterOptions {
118119 * @public
119120 */
120121export function createAdapter (
121- pool : any ,
122+ pool : Pool ,
122123 opts : Partial < PostgresAdapterOptions > = { }
123124) {
124125 return function ( nsp : any ) {
@@ -136,7 +137,7 @@ export class PostgresAdapter extends Adapter {
136137 public payloadThreshold : number ;
137138 public cleanupInterval : number ;
138139
139- private readonly pool : any ;
140+ private readonly pool : Pool ;
140141 private client : any ;
141142 private nodesMap : Map < string , number > = new Map < string , number > ( ) ; // uid => timestamp of last message
142143 private heartbeatTimer : NodeJS . Timeout | undefined ;
@@ -152,7 +153,11 @@ export class PostgresAdapter extends Adapter {
152153 *
153154 * @public
154155 */
155- constructor ( nsp : any , pool : any , opts : Partial < PostgresAdapterOptions > = { } ) {
156+ constructor (
157+ nsp : any ,
158+ pool : Pool ,
159+ opts : Partial < PostgresAdapterOptions > = { }
160+ ) {
156161 super ( nsp ) ;
157162 this . pool = pool ;
158163 this . uid = opts . uid || randomId ( ) ;
0 commit comments