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