Teensy + W5500 + Websocket server

Status
Not open for further replies.

overthrow

Member
I've been searching threads for anyone running a websocket server on a Teensy and I just see some dead threads from over a year ago.

Is anyone doing this? Any code you can share? I'm trying to control some motor controllers with a Teensy and with motors, etc. Windows is too unreliable to use USB and C# Serial implementation is trash so I'd prefer to use Websocket. I'm doing it now with a RPI but I'd prefer the simplicity and reliability of a Teensy.
 
Let's talk about what a websocket example should look like. Maybe I'll write one....

To get this conversation started, maybe you could explain to me what the non-Teensy side of the example should be?
 
On the client side I'm connecting from Unity using a .NET library. I'm making websocket connection from sending data and another for receiving it. In the robotics application I have I'm connecting to a lot of different sensors. One websocket is for an IMU, another is encoders, roboclaw motor controller, OLED screens (robot eyes), WS2811B LEDs, dollar bill acceptor, and pressure sensors.

But with all of these I find it best to have the websocket server be on the sensor side and have Unity make only client calls. Data is all ASCII text.
 
Ok, but let's talk about what an example published with the Ethernet library should look like?

Kinda doesn't seem practical to distribute an example which requires someone to have Unity, dot net framework (presumably Windows only), and a very project specific setup.
 
I think all the major programming languages already have client libraries for websockets. If you want to include a client example I would probably do it with Python. On the Teensy side one example should be for receiving commands, possibly commands to turn on Octo2811 LEDs, or even a single digitalWrite connected LED. Another example could be streaming data out of the websocket server on the Teensy. Just doing an analogRead and streaming to each connected client would be a good enough example.

I've been using the Python websockets library for the server side on the RPI. But there's some sample Client code down the page a little. https://websockets.readthedocs.io/en/stable/intro.html
 
As far as a server example is concerned, I'm not planning to write such a thing (or library). But if anyone wants to contribute an example program....
 
W5500.

DSC_0154_web.jpg
 
The Websocket library looks very promising.
I does mention it does not support "Sec-Websocket-Key".
Do you know if it is possible to add this option? I want to use an existing Websocket sever on nearlyfreespeech.net but it needs a sec key to be send too.

It's all a bit new to me but would be great to hear how likely it is for this feature to make it in to the library.
Thank you.
 
Status
Not open for further replies.
Back
Top