I've got a brand new EspruinoWifi and flashed v1.95 via web IDE.
From http://www.espruino.com/Modules I take it that the module EspruinoWifi (or .. 0V25) is builtin, but this doesn't seem to be the case.
Is this a glitch in the docs or in the code - or do I miss something?

This is good news and telnet surviving reset would be a good reason for me to upgrade the firmware.
Requiring EspruinoWiFi as builtin module can be done directly on the naked Espruino, no upload and save (e.g. through the Web IDE) involved. This makes the preparation of the device for wireless only operation easier - no big deal, but more comfortable.
All the Espruinos are well designed, powerfull devices and your support in the forums makes them even greater :)

And if this code, along with the wifi setup (all nicely wrapped in a function), is set e.g. by E.setBootCode(..) - will it come up again after reset()? Such that a new telnet session can be established without cycling power of the device?

They really don't - it was literally just a typo in my original post, which I have now corrected :) Did you actually try it and notice a problem?

I'm still not sure about the Wifi.save() functionality. Especially on the 512k ESP8266s, that 4k page of WiFi data would be way more useful if used to store JS rather than just 64 bytes of Wifi config. IMO there should be a more generic data store for variable data that isn't linked to Wifi (there is already FlashEEPROM though) - I think that might have been what you were asking @MaBe?

I am working on something that'll open up the standard Espruino saved code area, and which will finally allow JS files to be written in chunks (so you can upload more data than there is RAM), so hopefully Wifi.save could move over to that and we could add something for the Espruino WiFi board - although I'm still not super sure about the auto-connect functionality given how easy it is to just do wifi.connect(username, password in onInit and know exactly when wifi is initialised and when it isn't.

Actually, the line conn.on('close',function() {USB.setConsole();}) made the Wifi connect work

To me, this implies that some other computer is maybe trying to connect to port 23 briefly on the Espruino WiFi? The Telnet example before never returned the console when you disconnected, so that's sort of what you'd expect - Espruino WiFi would stay running, but you wouldn't be able to communicate over WiFi without that line above.

It would be a shame to loose this functionality.

I'm not planning on removing it from ESP32/8266/etc. But yes, for Telnet it's super handy - but I think that's the main one? obviously if you've got code already on the device then in many cases (IMO) it makes it more readable to have code there that explicitly connects to WiFi. Most ESP8266 code I've seen starts with a wifi.connect,save kind of thing anyway, where maybe just calling wifi.connect in onInit would give the programmer a bit more control over what happens if connection failed.

I find it quite a good feature of not having to include the SSID and credentials to the actual device code. It doesn't belong there. I use onInit() { wifi.on('connected', function() {}) }.

I wish I could do something like espruino -e 'wifi.connect($SSID, { password: $PASS },
() => wifi.save()) where I would be prompted to type in the password which would be sent to the board but I have yet to find a way which would not require saving the script to a file first.

Hopefully this new flash storage thing will open things up. At the very least you'll be able to put your WiFi credentials in setBootCode and have your code saved normally, but potentially we could also have a file for predefined variables that gets loaded automatically.

You probably know this, but if you do onInit() { wifi.on('connected', function() {}) } then each time onInit gets called (eg, if you save() twice) you'll get another handler. Just having the on('connected') outside onInit would be fine.

@opichals you could wrap that in a bash file and pass in flags, no? I use a small Go utility for ESP8266 which does exactly this - and returns IP address so subsequently can connect via IDE over Telnet

@Gordon Thanks for the 'Storage' module! Its use should to be a great way of not having to duplicate the serialization (JSON.stringify should suffice?) and flash access in the jswrap_wifi_save/restore methods. I would still vote for a .wifiauth file (or a more generic .config perhaps?) which would get loaded and wifi connected after every reset independently of the E.setBootCode stuff.

BTW What would you think of using a leading dot (or perhaps some other character of your liking) in the filename as a nice way of distinguishing internal files.

Also thank you for the onInit() { on('connected', ...) } note, I haven't noticed that before for some reason.

@Ollie I somehow didn't spend too much time but I think I could not find a way to pass arguments/env variable values to the espruino npm's cli .js script.