fix: java thread need direct callback socket
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
		@@ -111,7 +111,7 @@ export class Client extends EventEmitter {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        const nsp = this.server.of(name)
 | 
					        const nsp = this.server.of(name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const socket = nsp._add(this, auth, () => {
 | 
					        nsp._add(this, auth, (socket: Socket) => {
 | 
				
			||||||
            this.sockets.set(socket.id, socket)
 | 
					            this.sockets.set(socket.id, socket)
 | 
				
			||||||
            this.nsps.set(nsp.name, socket)
 | 
					            this.nsps.set(nsp.name, socket)
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,7 +94,7 @@ export class Namespace extends EventEmitter {
 | 
				
			|||||||
    in(name: string): Namespace {
 | 
					    in(name: string): Namespace {
 | 
				
			||||||
        return this.to(name)
 | 
					        return this.to(name)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    _add(client: Client, query?: any, fn?: () => void) {
 | 
					    _add(client: Client, query?: any, fn?: (socket: Socket) => void) {
 | 
				
			||||||
        const socket = new Socket(this, client, query || {})
 | 
					        const socket = new Socket(this, client, query || {})
 | 
				
			||||||
        console.debug(`client ${client.id} adding socket ${socket.id} to nsp ${this.name}`)
 | 
					        console.debug(`client ${client.id} adding socket ${socket.id} to nsp ${this.name}`)
 | 
				
			||||||
        this.run(socket, err => {
 | 
					        this.run(socket, err => {
 | 
				
			||||||
@@ -114,7 +114,8 @@ export class Namespace extends EventEmitter {
 | 
				
			|||||||
                    // violations (such as a disconnection before the connection
 | 
					                    // violations (such as a disconnection before the connection
 | 
				
			||||||
                    // logic is complete)
 | 
					                    // logic is complete)
 | 
				
			||||||
                    socket._onconnect()
 | 
					                    socket._onconnect()
 | 
				
			||||||
                    if (fn) fn()
 | 
					                    // !!! at java multi thread need direct callback socket
 | 
				
			||||||
 | 
					                    if (fn) fn(socket)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // fire user-set events
 | 
					                    // fire user-set events
 | 
				
			||||||
                    super.emit(ServerEvent.connect, socket)
 | 
					                    super.emit(ServerEvent.connect, socket)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user