File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const debug = debugModule("socket.io:client");
13
13
interface WriteOptions {
14
14
compress ?: boolean ;
15
15
volatile ?: boolean ;
16
+ preEncoded ?: boolean ;
16
17
wsPreEncoded ?: string ;
17
18
}
18
19
@@ -200,12 +201,14 @@ export class Client<
200
201
* @param {Object } opts
201
202
* @private
202
203
*/
203
- _packet ( packet : Packet , opts : WriteOptions = { } ) : void {
204
+ _packet ( packet : Packet | any [ ] , opts : WriteOptions = { } ) : void {
204
205
if ( this . conn . readyState !== "open" ) {
205
206
debug ( "ignoring packet write %j" , packet ) ;
206
207
return ;
207
208
}
208
- const encodedPackets = this . encoder . encode ( packet ) ;
209
+ const encodedPackets = opts . preEncoded
210
+ ? ( packet as any [ ] ) // previous versions of the adapter incorrectly used socket.packet() instead of writeToEngine()
211
+ : this . encoder . encode ( packet as Packet ) ;
209
212
for ( const encodedPacket of encodedPackets ) {
210
213
this . writeToEngine ( encodedPacket , opts ) ;
211
214
}
You can’t perform that action at this time.
0 commit comments