Skip to content

Commit

Permalink
bump ws to 8.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
clemos authored and stephane-klein committed Nov 14, 2023
1 parent 0cb5412 commit 48a1435
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
7 changes: 3 additions & 4 deletions bin/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

import ws from 'ws'
import { WebSocketServer } from 'ws'
import http from 'http'
import * as map from 'lib0/map'

Expand All @@ -12,8 +12,7 @@ const wsReadyStateClosed = 3 // eslint-disable-line
const pingTimeout = 30000

const port = process.env.PORT || 4444
// @ts-ignore
const wss = new ws.Server({ noServer: true })
const wss = new WebSocketServer({ noServer: true })

const server = http.createServer((request, response) => {
response.writeHead(200, { 'Content-Type': 'text/plain' })
Expand Down Expand Up @@ -81,7 +80,7 @@ const onconnection = conn => {
closed = true
})
conn.on('message', /** @param {object} message */ message => {
if (typeof message === 'string') {
if (typeof message === 'string' || message instanceof Buffer) {
message = JSON.parse(message)
}
if (message && message.type && !closed) {
Expand Down
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"yjs": "^13.5.6"
},
"optionalDependencies": {
"ws": "^7.2.0"
"ws": "^8.13.0"
},
"engines": {
"node": ">=12"
Expand Down

0 comments on commit 48a1435

Please sign in to comment.