MCPcopy
hub / github.com/nestjs/nest / initializeAdapter

Method initializeAdapter

packages/websockets/socket-module.ts:116–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114 }
115
116 private initializeAdapter() {
117 const forceCloseConnections = (this.appOptions as NestApplicationOptions)
118 .forceCloseConnections;
119 const adapter = this.applicationConfig.getIoAdapter();
120 if (adapter) {
121 (adapter as AbstractWsAdapter).forceCloseConnections =
122 forceCloseConnections!;
123 this.isAdapterInitialized = true;
124 return;
125 }
126 const { IoAdapter } = loadAdapter(
127 '@nestjs/platform-socket.io',
128 'WebSockets',
129 () => require('@nestjs/platform-socket.io'),
130 );
131 const ioAdapter = new IoAdapter(this.httpServer);
132 ioAdapter.forceCloseConnections = forceCloseConnections;
133 this.applicationConfig.setIoAdapter(ioAdapter);
134
135 this.isAdapterInitialized = true;
136 }
137
138 private getContextCreator(container: NestContainer): WsContextCreator {
139 return new WsContextCreator(

Callers 1

Calls 3

loadAdapterFunction · 0.90
getIoAdapterMethod · 0.80
setIoAdapterMethod · 0.80

Tested by

no test coverage detected