GithubHelp home page GithubHelp logo

Comments (6)

aaugustin avatar aaugustin commented on June 25, 2024

Based on the line you're mentionning, it seems that websockets is receiving a message aimed at a server when it's configured as a client, or vice versa.

Are you sure you're running a websockets server and not a client? Could you share the code you're using to start your websockets test server?

from websockets.

achille-roussel avatar achille-roussel commented on June 25, 2024

I basically copy/pasted the code available in the documentation, simply trying to make a echo server:
Something like that:

import asyncio
import websockets

@asyncio.coroutine
def hello(websocket, path):
    while True:
        message = yield from websocket.recv()
        if message is None:
            break
        yield from websocket.send(message)

start_server = websockets.serve(hello, 'localhost', 8080)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()  

Then I ran thor with something like "thor --amount 10 --messages 10 ws://localhost:8080"

from websockets.

aaugustin avatar aaugustin commented on June 25, 2024

As far as I can tell, you must use the --masked option of Thor for testing client-to-server connections. I have no idea why this is an option, it's clearly mandatory!

Not checking the mask bit would create a security issue. See https://tools.ietf.org/html/rfc6455#section-5.3. I'm surprised that many implementation ignore it.

Can you give a few examples of implementations you have tested?

from websockets.

achille-roussel avatar achille-roussel commented on June 25, 2024

I've tried with gevent-websocket, Qt Websocket, websocket.io and node.js websocket. All successfully accepted thor's default mode.

--masked made it work, thanks for taking the time to help with that :)

from websockets.

aaugustin avatar aaugustin commented on June 25, 2024

Excellent.

You can file bugs against these four implementations becase they don't honor https://tools.ietf.org/html/rfc6455#section-5.1:

The server MUST close the connection upon receiving a frame that is not masked.

from websockets.

aaugustin avatar aaugustin commented on June 25, 2024

I just filed a bug against Thor: observing/thor#8

from websockets.

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.