-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MicroWebSrv2 on W5500-EVB-Pico for WebSockets #92
Comments
I switched to a nightly build of micropython (official) and now I don't need to comment the 3 socket settings... |
Hi @philippebourcier and thank you for using this web server 👍🏻 Well, do you have trying the example with main.py file ? def OnWebSocketAccepted(microWebSrv2, webSocket) :
print('WebSocket accepted:')
webSocket.OnTextMessage = OnWebSocketTextMsg
#webSocket.OnBinaryMessage = OnWebSocketBinaryMsg
#webSocket.OnClosed = OnWebSocketClosed
def OnWebSocketTextMsg(webSocket, msg) :
print('WebSocket text message: %s' % msg)
wsMod.OnWebSocketAccepted = OnWebSocketAccepted Also, do you have checked if you can receive a msg sent by the server to your javascript? |
OK, looks like I had copied a bad example (SendText vs SendTextMessage, etc. 🤦♂️)... 🤷♂️
When the browser idles, the websocket server becomes unavailable (socket seems closed)... |
You mean that when the browser stays connected with a javascript websocket that doesn't transmit, the server on the card doesn't accept other websockets? I'm not sure I understand in fact. There are many parameters that can be configured indeed, I have to understand your problem because all the interactions with the sockets in the server are managed by my XAsyncSockets lib (with event management, buffers, concurrency and parralelism). |
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 (🤷♂️) :
(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) :
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.
The text was updated successfully, but these errors were encountered: