@@ -114,28 +114,28 @@ export class Adapter extends EventEmitter {
114
114
const ids = new Set ( ) ;
115
115
116
116
packet . nsp = this . nsp . name ;
117
- this . encoder . encode ( packet , encodedPackets => {
118
- if ( rooms . size ) {
119
- for ( const room of rooms ) {
120
- if ( ! this . rooms . has ( room ) ) continue ;
121
-
122
- for ( const id of this . rooms . get ( room ) ) {
123
- if ( ids . has ( id ) || except . has ( id ) ) continue ;
124
- const socket = this . nsp . connected . get ( id ) ;
125
- if ( socket ) {
126
- socket . packet ( encodedPackets , packetOpts ) ;
127
- ids . add ( id ) ;
128
- }
129
- }
130
- }
131
- } else {
132
- for ( const [ id ] of this . sids ) {
133
- if ( except . has ( id ) ) continue ;
117
+ const encodedPackets = this . encoder . encode ( packet ) ;
118
+
119
+ if ( rooms . size ) {
120
+ for ( const room of rooms ) {
121
+ if ( ! this . rooms . has ( room ) ) continue ;
122
+
123
+ for ( const id of this . rooms . get ( room ) ) {
124
+ if ( ids . has ( id ) || except . has ( id ) ) continue ;
134
125
const socket = this . nsp . connected . get ( id ) ;
135
- if ( socket ) socket . packet ( encodedPackets , packetOpts ) ;
126
+ if ( socket ) {
127
+ socket . packet ( encodedPackets , packetOpts ) ;
128
+ ids . add ( id ) ;
129
+ }
136
130
}
137
131
}
138
- } ) ;
132
+ } else {
133
+ for ( const [ id ] of this . sids ) {
134
+ if ( except . has ( id ) ) continue ;
135
+ const socket = this . nsp . connected . get ( id ) ;
136
+ if ( socket ) socket . packet ( encodedPackets , packetOpts ) ;
137
+ }
138
+ }
139
139
}
140
140
141
141
/**
0 commit comments