Skip to content

Commit

Permalink
fix: websocket imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Jun 28, 2022
1 parent 8ea5a8d commit eae5400
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/events/websocket/WebSocketClients.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import WebSocket from 'ws'
import { WebSocket } from 'ws'
import { isBoom } from '@hapi/boom'
import { log } from '@serverless/utils/log.js'
import {
Expand Down Expand Up @@ -275,6 +275,7 @@ export default class WebSocketClients {

const authorizerData = this.#webSocketAuthorizersCache.get(connectionId)
let authorizedEvent

if (authorizerData) {
authorizedEvent = event
authorizedEvent.requestContext.identity = authorizerData.identity
Expand Down
4 changes: 2 additions & 2 deletions src/events/websocket/WebSocketServer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { log } from '@serverless/utils/log.js'
import WebSocket from 'ws'
import { WebSocketServer as WsWebSocketServer } from 'ws'
import { createUniqueId } from '../../utils/index.js'

export default class WebSocketServer {
Expand All @@ -13,7 +13,7 @@ export default class WebSocketServer {
this.#options = options
this.#webSocketClients = webSocketClients

const server = new WebSocket.WebSocketServer({
const server = new WsWebSocketServer({
server: sharedServer,
verifyClient: ({ req }, cb) => {
const connectionId = createUniqueId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'node:assert'
import { dirname, resolve } from 'node:path'
import { env } from 'node:process'
import { fileURLToPath } from 'node:url'
import WebSocket from 'ws'
import { WebSocket } from 'ws'
import { joinUrl, setup, teardown } from '../_testHelpers/index.js'
import websocketSend from '../_testHelpers/websocketPromise.js'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'node:assert'
import { dirname, resolve } from 'node:path'
import { env } from 'node:process'
import { fileURLToPath } from 'node:url'
import WebSocket from 'ws'
import { WebSocket } from 'ws'
import { joinUrl, setup, teardown } from '../_testHelpers/index.js'
import websocketSend from '../_testHelpers/websocketPromise.js'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'node:assert'
import { dirname, resolve } from 'node:path'
import { env } from 'node:process'
import { fileURLToPath } from 'node:url'
import WebSocket from 'ws'
import { WebSocket } from 'ws'
import { joinUrl, setup, teardown } from '../_testHelpers/index.js'
import websocketSend from '../_testHelpers/websocketPromise.js'

Expand Down

0 comments on commit eae5400

Please sign in to comment.