grblHAL / Plugin_networking

grblHAL plugin for networking protocols (Telnet, WebSocket, FTP, HTTP) and related utilities on top of LwIP
Other
10 stars 6 forks source link

Which is better? WebSockets or Telnet? #1

Closed karoria closed 1 year ago

karoria commented 3 years ago

Hi @terjeio,

I want to make my own communication interface for grblHAL with Teensy4.1. I don't want to use USB serial to take advantage of robust ethernet connection. Now the question is should I use Telnet or WS? I am pretty sure, I can code my interface both ways but I am unclear about any disadvantage of using WS. I want to use Raspberry Pi 4 to communicate with controller. I will make RPi4 an http server, so that I can access my interface through any LAN connected device. I have 2 options:

  1. Making RPi4 an http server with telnet communication to controller
  2. Making Teensy 4.1 a WS server and use client side code in each LAN connected device including RPi4

I am not sure which way is better for me. Your guidance will be appreciated.

terjeio commented 3 years ago

Telnet is perhaps better for you as it is far simpler to code for, open a socket an you are ready to communicate. But if the code connecting to the websocket is running in a browser then a websocket connection will be easier?

Be aware that grblHAL now has webserver (http) support. The WebUI plugin uses it for the ESP32-WEBUI.

karoria commented 3 years ago

Yes, the UI will run in a browser. Basically it is a NodeJs project, but still telnet is easier to code than WS as I feel. Now the game changer is http webserver that I was not knowing. How much memory I get on teensy4.1 to write http webserver? I know Luc's webUI, but mine will be a little resource demanding. Thanks for your time.

karoria commented 3 years ago

OK. I can see the instructions in WebUI plugin to copy the www plugin to SD card. That means the http webserver is hosted from memory card. It should also mean it doesn't have controller specific storage limitations as it uses SD memory. I will have to check how it performs if that is the case.

terjeio commented 3 years ago

I will have to check how it performs if that is the case.

It is the case, and loading and starting the 156K (compressed) application happens in the blink of an eye (less than a second).

image

karoria commented 3 years ago

Thanks @terjeio, I am inclined to use http server through teensy. I can't find the folder hierarchy wiki after this project is re-organized to use sub-modules. I hope only "core" and "driver" repos to be cloned dependencies are taken care automatically. If so, should "core" project be inside "driver" project?

karoria commented 3 years ago

I am using PIO.

terjeio commented 3 years ago

Download info here.

karoria commented 3 years ago

Thanks a lot.