Coder Social home page Coder Social logo

opcodes are incorrect about websocket-monitor HOT 4 OPEN

tdhsmith avatar tdhsmith commented on August 19, 2024
opcodes are incorrect

from websocket-monitor.

Comments (4)

tdhsmith avatar tdhsmith commented on August 19, 2024 1

Here's a quick demonstration server in NodeJS, if that helps. Sorry for the messy code; threw it together on lunch break.

https://gist.github.com/tdhsmith/8e71aba02c684f549cdec05761e6e87b

You'll need to install ws first. Run the server with node server.js then browse to http://localhost:3000/ and the browser and client will each send a variety of frame types.

Here's what I see:

Server

-> TEXT         (0x1); MASKED
-> BINARY       (0x2); MASKED
<- BINARY       (0x2); unmasked
<- PING         (0x9); unmasked
<- PONG         (0xA); unmasked
<- TEXT         (0x1); unmasked
<- CONTINUATION (0x0); unmasked
<- CLOSE        (0x8)
-> PONG         (0xA); MASKED
-> CLOSE        (0x8)

(note that the ordering of the last few is off slightly due to when I'm calling the log commands relative to the actual message queue)

WireShark

screen shot 2017-01-18 at 11 43 10 am

Raw capture file is available in the gist above.

websocket-monitor

screen shot 2017-01-18 at 11 46 39 am

from websocket-monitor.

tdhsmith avatar tdhsmith commented on August 19, 2024

Actually I'm just realizing the inaccuracies are a bit larger than that:

  • all frames are marked as having maskBit=true when they aren't (in my case messages from the server are being sent unmasked)
  • disconnect frame is displayed as raw text with the reason code appended to the front. For example �ëonly text frames are supported, where the gibberish 0x03eb on the front should be parsed as reason code=1003.

(I don't have the capability right now to modify my stack to send true continuation frames with finBit=0, so I can't verify if the finBit is parsing correctly or not.)

from websocket-monitor.

eliihen avatar eliihen commented on August 19, 2024

Yeah, the entire frame, including the metadata like opcode, comes from the Firefox API we're using to read websockets. We pretty much only map that to a string. I can't really give any info on the Firefox API because I haven't been that deep.

Let's try pinging @bakulf, he seems knowledgeable on the matter.

from websocket-monitor.

bakulf avatar bakulf commented on August 19, 2024

Can I have a testcase? I would like to test it locally. @esphen, thanks.

from websocket-monitor.

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.