Skip to content

Commit

Permalink
Merge pull request #58 from stephane-klein/upgrade-yjs-ws-y-protocols…
Browse files Browse the repository at this point in the history
…-packages

Upgrade yjs ws y protocols packages
  • Loading branch information
dmonad authored Nov 16, 2023
2 parents 0cb5412 + 0011323 commit 135dffa
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 44 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
88 changes: 52 additions & 36 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"dependencies": {
"lib0": "^0.2.42",
"simple-peer": "^9.11.0",
"y-protocols": "^1.0.5"
"y-protocols": "^1.0.6"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.1.0",
Expand All @@ -73,13 +73,13 @@
"rollup-plugin-terser": "^5.3.1",
"standard": "^14.3.4",
"typescript": "^4.4.4",
"yjs": "^13.5.20"
"yjs": "^13.6.8"
},
"peerDependencies": {
"yjs": "^13.5.6"
"yjs": "^13.6.8"
},
"optionalDependencies": {
"ws": "^7.2.0"
"ws": "^8.14.2"
},
"engines": {
"node": ">=12"
Expand Down

0 comments on commit 135dffa

Please sign in to comment.