Skip to content

Commit 6011e10

Browse files
committed
feat: connect event on server
1 parent cc99465 commit 6011e10

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/ServerClient.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import RequestSuccess from "./packets/RequestSuccess.js"
5555
export type ServerClientEvents = {
5656
error: (error: Error) => void
5757
close: () => void
58+
connect: () => void
5859
debug: (...message: any[]) => void
5960
message: (message: Buffer) => void
6061
clientProtocolVersion: (version: ProtocolVersionExchange) => void
@@ -275,6 +276,8 @@ export default class ServerClient extends (EventEmitter as new () => TypedEventE
275276

276277
await this.handleAuthentication()
277278
// user is logged in!
279+
// emit the event
280+
this.emit("connect")
278281

279282
// now that we have received USERAUTH_SUCCESS, we need
280283
// to handle GLOBAL_REQUEST.
@@ -419,6 +422,7 @@ export default class ServerClient extends (EventEmitter as new () => TypedEventE
419422
}
420423
const controller: ServerHookerPublicKeyAuthenticationController = {
421424
// both are independant since you can also allowLogin without checking the signature
425+
// would sucks tho !
422426
requestSignature: false,
423427
allowLogin: false,
424428
}

src/index_server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const server = new Server({
1414
})
1515
server.on("debug", console.debug)
1616

17-
server.listen(1023, () => {
18-
server.debug("Server listening on port", 1023)
17+
server.listen(3022, () => {
18+
server.debug("Server listening on port", 3022)
1919
})
2020

2121
server.on("connection", (client) => {

0 commit comments

Comments
 (0)