Giter VIP home page Giter VIP logo

Comments (3)

kearfy avatar kearfy commented on June 3, 2024 1

Hey everyone! I wasn't able to reproduce this issue last week, turns out that nvm was playing with me 😅

I was however able to reproduce it today, and it turns out that the MessageEvent class does not pass back a required data property, according the MDN: https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/data

I'm quite positive that this is an issue in NodeJS

from surrealdb.js.

Dhghomon avatar Dhghomon commented on June 3, 2024

@kearfy

from surrealdb.js.

tai-kun avatar tai-kun commented on June 3, 2024

I have the same issue.

This is likely not a bug in surrealdb.js, but rather a bug in undici or a non-compliance with the WebSocket specification (RFC 6455) by other WebSocket clients.

The WebSocket class, which was added to the global namespace without a flag in Node.js v22, is implemented within undici and seems to behave slightly differently from other WebSocket clients (Deno and ws).

Specifically, there is a discrepancy in how chunked data sent from the WebSocket server is interpreted. undici does not reset the opcode unless chunked data containing a payload is sent. This means that when a ping response (<Buffer 89 00>) is received from the WebSocket server, undici remembers that the opcode is 9 (i.e. "Ping Frame") and ultimately drops the payload of subsequent chunked data. This ping communication is performed by the WebSocket to maintain the connection, independently of surrealdb.js's Pinger.

To resolve this issue, it may be necessary to make changes to the implementation of undici. I'm using Node.js v22.1.0 and have checked the behavior with undici v6.13.0, but I have also obtained the same results with the latest version, v6.16.0.

However, the WebSocket specification is quite complex, and I am not entirely sure if this is a bug in undici. It is also possible that undici's WebSocket implementation is correct and other implementations are not compliant with the specification.

from surrealdb.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.