Skip to content

Commit

Permalink
refactor: http server instantation for websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Sep 22, 2022
1 parent af68056 commit 4c7a034
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/events/websocket/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export default class HttpServer {
constructor(options, webSocketClients) {
this.#options = options
this.#webSocketClients = webSocketClients
}

const { host, websocketPort, httpsProtocol } = options
async createServer() {
const { host, websocketPort, httpsProtocol } = this.#options

const serverOptions = {
host,
Expand Down
2 changes: 2 additions & 0 deletions src/events/websocket/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default class WebSocket {

this.#httpServer = new HttpServer(this.#options, webSocketClients)

await this.#httpServer.createServer()

// share server
this.#webSocketServer = new WebSocketServer(
this.#options,
Expand Down

0 comments on commit 4c7a034

Please sign in to comment.