Comments (4)
ah, this probably happened because you are using ws@^8 already, while we were still at ^7. Just weird that I didn't see this, because I actually upgraded this week 🤔 anyway, will merge it. thx!
from hocuspocus.
@akwirick Can you share the log / error that you were seeing? Which node version do you use?
Havent seen any issues related to this, and I actually have zero idea what that changes means. I just put together a PR and will check now what tests say, but not sure what that is doing :)
from hocuspocus.
Here's a snippet from my logs when the binarytype is set to arraybuffer
{"level":50,"time":1696907675863,"pid":20597,"hostname":"Bear","err":{"type":"TypeError","message":"The \"chunk\" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ArrayBuffer","stack":"TypeError [ERR_INVALID_ARG_TYPE]: The \"chunk\" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ArrayBuffer\n at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)\n at new NodeError (node:internal/errors:405:5)\n at readableAddChunk (node:internal/streams/readable:285:13)\n at Readable.push (node:internal/streams/readable:253:10)\n at WebSocket.message (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/stream.js:64:17)\n at WebSocket.emit (node:events:526:35)\n at Receiver.receiverOnMessage (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1192:20)\n at Receiver.emit (node:events:514:28)\n at Receiver.dataMessage (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:545:14)\n at Receiver.getData (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:478:17)\n at Receiver.startLoop (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:167:22)\n at Receiver._write (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/receiver.js:93:10)\n at writeOrBuffer (node:internal/streams/writable:399:12)\n at _write (node:internal/streams/writable:340:10)\n at Writable.write (node:internal/streams/writable:344:10)\n at Socket.socketOnData (/home/awirick/src/ai-platform/node_modules/.pnpm/[email protected]/node_modules/ws/lib/websocket.js:1286:35)\n at Socket.emit (node:events:514:28)\n at addChunk (node:internal/streams/readable:343:12)\n at readableAddChunk (node:internal/streams/readable:316:9)\n at Readable.push (node:internal/streams/readable:253:10)\n at TCP.onStreamRead (node:internal/stream_base_commons:190:23)","code":"ERR_INVALID_ARG_TYPE"},"msg":"The \"chunk\" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of ArrayBuffer"}
Basically, the ws
library is expecting a Buffer or Uint8Array but is receiving the ArrayBuffer. Theoretically, it should be possible to get ArrayBuffer's to work as well but it really doesn't make sense to not use either nodebuffer
or fragment
if we are running in a Node environment.
from hocuspocus.
For more context, this is running on a fastify server operating in http1.1 mode. Everything else seems to work fine there, just this one little unexpected type issue.
from hocuspocus.
Related Issues (20)
- Support logging request/socket information in custom Logger.log function HOT 1
- Unsure how to fallback gracefully from initial provider connection issues HOT 2
- Migrate from slate js to prosemirror HOT 1
- Unnecessary onStoreDocumentHooks call on last connection close (potential data loss) HOT 1
- Provider downloads document content twice when syncing initially HOT 1
- Hang caused by not cleaning up Awareness in provider HOT 1
- Do collaboration history and auto-versioning work? HOT 1
- Add custome field to the Webhook
- Provider.disconnect prevents subsequent provider.connect from working HOT 1
- 2.10.0 breaks provider in nodejs HOT 8
- The server document judgment is always empty, resulting in duplicate data. HOT 2
- backend onChange undefined HOT 2
- Server crashed when webhook receives 400 status code response HOT 3
- Inaccurate document type check in onLoadDocument
- use lexical TypeError: The encoded data was not valid for encoding utf-8 HOT 1
- Updates made using openDirectConnection are not synchronizing changes across different Redis instances. HOT 9
- provider.destroy will reopen connection HOT 2
- About the actual storage size of documents during collaborative editing HOT 8
- An authentication token is required, but you didn’t send one - but token was actually included HOT 7
- Connections to doc are possible while `onLoadDocument` is still in progress
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hocuspocus.