I think Arduino is trying to do macro's with D1...D13 mappings. The pin numbers are different from what is "usually used" as int values for pins.
Here are the mappings for the Esp8226 board
For mine LED which is usually pin 13 == 14 on my D1 board
8266 Series 12 GPIO Table | |||
IO index | ESP8266 pin | IO index | ESP8266 pin |
0 | GPIO_16 | 7 | GPIO_13 |
1 | GPIO_05 | 8 | GPIO_15 |
2 | GPIO_04 | 9 | GPIO_03 |
3 | GPIO_00 | 10 | GPIO_01 |
4 | GPIO_02 | 11 | GPIO_09 |
5 | GPIO_14 | 12 | GPIO_10 |
6 | GPIO_12 |
Websockets would be fun - but this https://github.com/morrissinger/ESP8266-Websocket
Did not work for me ... with compiling error
References :