@@ -261,34 +261,36 @@ class SocketIOServer extends SocketServer {
261261 let client ;
262262 let subClient ;
263263 const options = { ...config ?. options } ;
264- const adapterFactory = SocketServer . require ( config . impl ) ;
265- switch ( config . impl ) {
266- case "@socket.io/redis-adapter" :
267- if ( await redis . connectionCheck ( config ) ) {
268- client = await redis . createPrimaryClientAndConnect ( config ) ;
269- if ( client ) {
270- subClient = await redis . createSecondaryClientAndConnect ( config ) ;
271- if ( subClient ) {
272- this . adapter = adapterFactory . createAdapter ( client , subClient , options ) ;
264+ const adapterFactory = SocketServer . require ( config . impl , "adapter" ) ;
265+ if ( adapterFactory ) {
266+ switch ( config . impl ) {
267+ case "@socket.io/redis-adapter" :
268+ if ( await redis . connectionCheck ( config ) ) {
269+ client = await redis . createPrimaryClientAndConnect ( config ) ;
270+ if ( client ) {
271+ subClient = await redis . createSecondaryClientAndConnect ( config ) ;
272+ if ( subClient ) {
273+ this . adapter = adapterFactory . createAdapter ( client , subClient , options ) ;
274+ }
273275 }
274276 }
275- }
276- break ;
277- case "@socket.io/ redis-streams-adapter" :
278- if ( await redis . connectionCheck ( config ) ) {
279- client = await redis . createPrimaryClientAndConnect ( config ) ;
280- if ( client ) {
281- this . adapter = adapterFactory . createAdapter ( client , options ) ;
277+ break ;
278+ case "@socket.io/redis-streams-adapter" :
279+ if ( await redis . connectionCheck ( config ) ) {
280+ client = await redis . createPrimaryClientAndConnect ( config ) ;
281+ if ( client ) {
282+ this . adapter = adapterFactory . createAdapter ( client , options ) ;
283+ }
282284 }
283- }
284- break ;
285- default :
286- this . adapter = adapterFactory . createAdapter ( this , options , config ) ;
287- break ;
288- }
289- if ( this . adapter ) {
290- this . io . adapter ( this . adapter ) ;
291- this . adapterActive = true ;
285+ break ;
286+ default :
287+ this . adapter = adapterFactory . createAdapter ( this , options , config ) ;
288+ break ;
289+ }
290+ if ( this . adapter ) {
291+ this . io . adapter ( this . adapter ) ;
292+ this . adapterActive = true ;
293+ }
292294 }
293295 }
294296 } catch ( err ) {
0 commit comments