@@ -663,53 +663,6 @@ export class RedisAdapter extends Adapter {
663663 super . broadcastWithAck ( packet , opts , clientCountCallback , ack ) ;
664664 }
665665
666- /**
667- * @deprecated Please use `namespace.fetchSockets()` instead.
668- *
669- * Gets a list of sockets by sid.
670- *
671- * @param {Set<Room> } rooms the explicit set of rooms to check.
672- */
673- public async sockets ( rooms : Set < Room > ) : Promise < Set < SocketId > > {
674- const localSockets = await super . sockets ( rooms ) ;
675- const numSub = await this . getNumSub ( ) ;
676- debug ( 'waiting for %d responses to "sockets" request' , numSub ) ;
677-
678- if ( numSub <= 1 ) {
679- return Promise . resolve ( localSockets ) ;
680- }
681-
682- const requestId = uid2 ( 6 ) ;
683- const request = JSON . stringify ( {
684- uid : this . uid ,
685- requestId,
686- type : RequestType . SOCKETS ,
687- rooms : [ ...rooms ] ,
688- } ) ;
689-
690- return new Promise ( ( resolve , reject ) => {
691- const timeout = setTimeout ( ( ) => {
692- if ( this . requests . has ( requestId ) ) {
693- reject (
694- new Error ( "timeout reached while waiting for sockets response" )
695- ) ;
696- this . requests . delete ( requestId ) ;
697- }
698- } , this . requestsTimeout ) ;
699-
700- this . requests . set ( requestId , {
701- type : RequestType . SOCKETS ,
702- numSub,
703- resolve,
704- timeout,
705- msgCount : 1 ,
706- sockets : localSockets ,
707- } ) ;
708-
709- this . pubClient . publish ( this . requestChannel , request ) ;
710- } ) ;
711- }
712-
713666 /**
714667 * Gets the list of all rooms (across every node)
715668 *
@@ -754,147 +707,6 @@ export class RedisAdapter extends Adapter {
754707 } ) ;
755708 }
756709
757- /**
758- * @deprecated Please use `namespace.socketsJoin()` instead.
759- *
760- * Makes the socket with the given id join the room
761- *
762- * @param {String } id - socket id
763- * @param {String } room - room name
764- * @public
765- */
766- public remoteJoin ( id : SocketId , room : Room ) : Promise < void > {
767- const requestId = uid2 ( 6 ) ;
768-
769- const socket = this . nsp . sockets . get ( id ) ;
770- if ( socket ) {
771- socket . join ( room ) ;
772- return Promise . resolve ( ) ;
773- }
774-
775- const request = JSON . stringify ( {
776- uid : this . uid ,
777- requestId,
778- type : RequestType . REMOTE_JOIN ,
779- sid : id ,
780- room,
781- } ) ;
782-
783- return new Promise ( ( resolve , reject ) => {
784- const timeout = setTimeout ( ( ) => {
785- if ( this . requests . has ( requestId ) ) {
786- reject (
787- new Error ( "timeout reached while waiting for remoteJoin response" )
788- ) ;
789- this . requests . delete ( requestId ) ;
790- }
791- } , this . requestsTimeout ) ;
792-
793- this . requests . set ( requestId , {
794- type : RequestType . REMOTE_JOIN ,
795- resolve,
796- timeout,
797- } ) ;
798-
799- this . pubClient . publish ( this . requestChannel , request ) ;
800- } ) ;
801- }
802-
803- /**
804- * @deprecated Please use `namespace.socketsLeave()` instead.
805- *
806- * Makes the socket with the given id leave the room
807- *
808- * @param {String } id - socket id
809- * @param {String } room - room name
810- * @public
811- */
812- public remoteLeave ( id : SocketId , room : Room ) : Promise < void > {
813- const requestId = uid2 ( 6 ) ;
814-
815- const socket = this . nsp . sockets . get ( id ) ;
816- if ( socket ) {
817- socket . leave ( room ) ;
818- return Promise . resolve ( ) ;
819- }
820-
821- const request = JSON . stringify ( {
822- uid : this . uid ,
823- requestId,
824- type : RequestType . REMOTE_LEAVE ,
825- sid : id ,
826- room,
827- } ) ;
828-
829- return new Promise ( ( resolve , reject ) => {
830- const timeout = setTimeout ( ( ) => {
831- if ( this . requests . has ( requestId ) ) {
832- reject (
833- new Error ( "timeout reached while waiting for remoteLeave response" )
834- ) ;
835- this . requests . delete ( requestId ) ;
836- }
837- } , this . requestsTimeout ) ;
838-
839- this . requests . set ( requestId , {
840- type : RequestType . REMOTE_LEAVE ,
841- resolve,
842- timeout,
843- } ) ;
844-
845- this . pubClient . publish ( this . requestChannel , request ) ;
846- } ) ;
847- }
848-
849- /**
850- * @deprecated Please use `namespace.disconnectSockets()` instead.
851- *
852- * Makes the socket with the given id to be forcefully disconnected
853- *
854- * @param {String } id - socket id
855- * @param {Boolean } close - if `true`, closes the underlying connection
856- *
857- * @public
858- */
859- public remoteDisconnect ( id : SocketId , close ?: boolean ) : Promise < void > {
860- const requestId = uid2 ( 6 ) ;
861-
862- const socket = this . nsp . sockets . get ( id ) ;
863- if ( socket ) {
864- socket . disconnect ( close ) ;
865- return Promise . resolve ( ) ;
866- }
867-
868- const request = JSON . stringify ( {
869- uid : this . uid ,
870- requestId,
871- type : RequestType . REMOTE_DISCONNECT ,
872- sid : id ,
873- close,
874- } ) ;
875-
876- return new Promise ( ( resolve , reject ) => {
877- const timeout = setTimeout ( ( ) => {
878- if ( this . requests . has ( requestId ) ) {
879- reject (
880- new Error (
881- "timeout reached while waiting for remoteDisconnect response"
882- )
883- ) ;
884- this . requests . delete ( requestId ) ;
885- }
886- } , this . requestsTimeout ) ;
887-
888- this . requests . set ( requestId , {
889- type : RequestType . REMOTE_DISCONNECT ,
890- resolve,
891- timeout,
892- } ) ;
893-
894- this . pubClient . publish ( this . requestChannel , request ) ;
895- } ) ;
896- }
897-
898710 public async fetchSockets ( opts : BroadcastOptions ) : Promise < any [ ] > {
899711 const localSockets = await super . fetchSockets ( opts ) ;
900712
0 commit comments