Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Added wssconnected and wssclosed to eventInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
PMK744 committed Jun 27, 2021
1 parent c43c843 commit 30f8d70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bewss/@interface/bewss.i.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ export interface EventValues {
RawEvent: [unknown] // Fires when any event is fired.
AgentCommand: [AgentCommand]
AgentCreated: [AgentCreated]
wssconnected: [unknown]
wssclosed: [unknown]

}

interface eventHeader {
Expand Down
2 changes: 2 additions & 0 deletions src/bewss/server/serverManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class serverManager {
async onDisabled(): Promise<void> {
this.ws.close()
this.bewss.getEventManager().emit('wss-closed')
this.bewss.getEventManager().emit('wssclosed', this.server)
this.bewss.getLogger().info('Websocket server closed.')
this.server = undefined

Expand All @@ -39,6 +40,7 @@ class serverManager {
this.server = wss
this.server.setMaxListeners(50)
this.bewss.getEventManager().emit('wss-connected')
this.bewss.getEventManager().emit('wssconnected', this.server)
this.bewss.getLogger().info('User connected to the server!')
this.bewss.getLogger().info('Do -help for a list of BeWss commands, do /help for a list of Bedrock commands.')
})
Expand Down

0 comments on commit 30f8d70

Please sign in to comment.