Skip to content

MicroWebSrv2 on W5500-EVB-Pico for WebSockets #92

@philippebourcier

Description

@philippebourcier

I am trying to get websockets to work on a W5500-EVB-Pico.
I need Ethernet (vs WiFi), because it will be for a low-latency project where I'll need

In XAsyncSockets.py, I had to comment the following 3 lines (🤷‍♂️) :

  • socket.settimeout(0)
  • socket.setblocking(0)
  • srvSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    (I guess the W5500 handles this on its side anyway...)

At this point, HTTP works just fine...

Then, I wrote a simple test script for the ws client (tested succesfully on an ESP-32) :

from time import sleep
ws = create_connection("ws://192.168.98.120/")
while True:
    print("Sending 'Hello, World'...")
    ws.send("Hello, World")
    print("Received '%s'" % ws.recv())
    sleep(1)
ws.close()

However, on the console I see the accept, but it seems the code isn't able to detect it's a text or binary input (or something else is going wrong)...
MWS2-DEBUG> From 192.168.98.11:80 GET / >> [101] Switching Protocols
MWS2-INFO> WebSocket accepted from 192.168.98.11:80.
WS ACCEPT

==> After receiving empty response I get a "Connection reset by peer" on the client side...

If I try again, same result :
MWS2-DEBUG> From 192.168.98.11:80 GET / >> [101] Switching Protocols
MWS2-INFO> WebSocket accepted from 192.168.98.11:80.
WS ACCEPT

Anyone achieved to get WebSockets working on RP2040 ?

@jczic, I can lend you a W5500-EVB-Pico if you want to test it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions