Skip to content
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

Espruino ESP32 missing "ws" module? #1832

Closed
Zibri opened this issue May 29, 2020 · 10 comments
Closed

Espruino ESP32 missing "ws" module? #1832

Zibri opened this issue May 29, 2020 · 10 comments
Labels
ESP32 This is only a problem on ESP32-based devices

Comments

@Zibri
Copy link

Zibri commented May 29, 2020

var WebSocket = require("ws");
Uncaught Error: Module ws not found
at line 1 col 29
var WebSocket = require("ws");

also:

wifi.getHostByName("google.com",console.log);
WARNING: Wifi.getHostByName
WARNING: Wifi.getHostByName: google.com
WARNING: Error: -5 from dns_gethostbyname
WARNING: Wifi.getHostByName CB - google.com 0
=undefined
null
WARNING: Wifi.getHostByName CB - google.com 3ffc78f8

process.env
={
VERSION: "2v05.118",
GIT_COMMIT: "b3403b73",
BOARD: "ESP32",
FLASH: 0, STORAGE: 262144, RAM: 524288,
SERIAL: "a4ff130a-7ef4",
CONSOLE: "Serial1",
MODULES: "Flash,Storage,hea" ... "r,crypto,neopixel",
EXPTR: 1073484860 }

@MaBecker MaBecker added the ESP32 This is only a problem on ESP32-based devices label May 30, 2020
@MaBecker
Copy link
Contributor

WS is a JS module

check this page http://www.espruino.com/ws

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

WS is a JS module

check this page http://www.espruino.com/ws

WebSockets are an integral part of today web comunication.
so they should be included by default, perhaps even converted in internal calls.

@MaBecker
Copy link
Contributor

MaBecker commented Jun 1, 2020

Well some parts are easyer to add via module like ws or mqtt.

Espruino is following the concept of adding modules via javascript to keep the firmware small.

You still have the possibility to build your own firmware and add what ever is needed for your projects.

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

I understand, but when I do var WebSocket = require("ws");

It just doesn't work even if ESP32 is connected to my access point.
or should I write:
require("http://www.espruino.com/modules/ws.js") ?

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

>var WebSocket = require("ws");
Uncaught Error: Module ws not found
 at line 1 col 29
var WebSocket = require("ws");
                            ^
>var WebSocket = require("http://www.espruino.com/modules/ws.js");
Uncaught Error: Module http://www.espruino.com/modules/ws.js not found
 at line 1 col 64
...espruino.com/modules/ws.js");
                              ^
> 

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

>wifi.ping("192.168.0.1",console.log);
=undefined
{ "totalCount": 1, "totalBytes": 60, "totalTime": 18, "respTime": 18,
  "seqNo": 1, "timeoutCount": 0, "bytes": 60, "error": 0 }
{ "totalCount": 2, "totalBytes": 120, "totalTime": 25, "respTime": 7,
  "seqNo": 2, "timeoutCount": 0, "bytes": 60, "error": 0 }
{ "totalCount": 3, "totalBytes": 180, "totalTime": 46, "respTime": 21,
  "seqNo": 3, "timeoutCount": 0, "bytes": 60, "error": 0 }
{ "totalCount": 4, "totalBytes": 240, "totalTime": 75, "respTime": 29,
  "seqNo": 4, "timeoutCount": 0, "bytes": 60, "error": 0 }
{ "totalCount": 5, "totalBytes": 300, "totalTime": 89, "respTime": 14,
  "seqNo": 5, "timeoutCount": 0, "bytes": 60, "error": 0 }
{ "totalCount": 5, "totalBytes": 300, "totalTime": 89, "respTime": 14,
  "seqNo": 6, "timeoutCount": 0, "bytes": 60, "error": 0 }
> 

but..

>wifi.getHostByName("google.com",console.log);
WARNING: Wifi.getHostByName
WARNING: Wifi.getHostByName: google.com
WARNING: Error: -5 from dns_gethostbyname
WARNING: Wifi.getHostByName CB - google.com 0
=undefined
null
WARNING: Wifi.getHostByName CB - google.com 3ffc78f8
> 

@gfwilliams
Copy link
Member

Are you using the Web IDE? And uploading using code on the right hand side? http://www.espruino.com/Troubleshooting#i-get-uncaught-error-module-xyz-not-found-

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

hmm yes.. but what does it have to do with
wifi.getHostByName("google.com",console.log);
?

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

Are you using the Web IDE? And uploading using code on the right hand side? http://www.espruino.com/Troubleshooting#i-get-uncaught-error-module-xyz-not-found-

oh.. I got it, the require is interpreted by the IDE and not by the firmware.. very strange implementation.
Anyway, the getHostByName does not work.

@Zibri
Copy link
Author

Zibri commented Jun 1, 2020

WebSocket is working but host resolution is NOT.

Uncaught InternalError: Unable to locate host

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ESP32 This is only a problem on ESP32-based devices
Projects
None yet
Development

No branches or pull requests

3 participants