davidallendj / ESP8266-Simple-Chat-Server

Simple chat server for the ESP8266 MCU
MIT License
1 stars 0 forks source link

Just checking in... #1

Open Hairyloon opened 1 year ago

Hairyloon commented 1 year ago

Is it bad manners to jump in and comment without first testing out the code? Probably it is, but I am not going to comment, other than to say that I am pleased to have found this project. I think I'd best go find an ESP and try it out...

davidallendj commented 1 year ago

I don't really mind, and I'm glad you found it interesting enough to reach out. Let me know if you need help getting things up and running.

Hairyloon commented 1 year ago

Well the hardest part of the problem was finding an ESP module that works, and that's not something you could easily help with. Then a minor glitch, which I presume was due to me forgetting to change the board in the configuration, and voila: it's working. Now to try to make it do what I want to do... Well, I say "Now", but I have a few other things I ought to get on with, but I'll share some of what I'm thinking of doing.

I want to set up a kind of virtual meeting point to enable collective decision making, for example at an allotment site. It'll need a number of pages, each with its own chat, I don't expect that to be difficult. It wants to remember people from visit to visit: I'm thinking maybe that can be done using MAC addresses. I'm wondering also if it can occasionally connect to t'internet through a passing Wi-Fi system and send an activity report back to base.

davidallendj commented 1 year ago

Hmmm...interesting indeed. I don't think implementing most of that would be too difficult at all. To your last point, I recall there being a way to use both STA and AP modes (MultiMode?) to connect devices to the board while also connecting it to another device like a router. I'll probably have a look at it this weekend and see what I can conjure up.

davidallendj commented 1 year ago

Looking back at some of the code, I remembered why I didn't use MAC addresses before: it's pretty much impossible to get such information because of security reasons without using an external program or browser extension and I was hoping to avoid needing anything more than the browser itself. I think my original plan was eventually to use session cookies + storing login information on the board with a small SQLite database. Granted, space is already very limited on the board so it can only reasonably store a few users login information using this board.

@Hairyloon Did you have any other ideas for for remembering people per visit? I'm think using the MAC addresses is probably going to be a no-go due to limitations of getting it from a browser.

Hairyloon commented 1 year ago

Did you have any other ideas for for remembering people per visit? I'm think using the MAC addresses is probably going to be a no-go due to limitations of getting it from a browser.

In my ignorance, I had assumed MAC addresses to be fairly straightforward, so I hadn't given it much thought. I have it now in mind, so I'll let you know if anything comes to me.

ETA: doing some rummaging on t'internet, somebody recommended ESP-NOW in answer to a related question, I don't know if that helps at all... https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html It looks to me like it's opening a whole new kettle of fish.

ETFA: In this thread (https://www.esp8266.com/viewtopic.php?f=32&t=5669) they discuss getting a list of clients, which includes their MAC addresses... Also https://github.com/Crypter/MAChaser

davidallendj commented 1 year ago

Ah, I see. It's not using the browser at all to get the MAC address. In fact, I already have a scan_networks function in utils.cpp that does that, so adding the MAC address should actually be straightforward.

Edit: So after looking even closer at the code, I realized that the bssid IS the MAC address, so it is indeed already being stored. The naming certainly threw me for a loop for a minute lol...

https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/scan-class.html#bssid

Hairyloon commented 1 year ago

Ah good. I was a little worried that I had misunderstood the problem and was being pushy with the wrong solution.