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

sample HttpServer_WebSockets does not work #1262

Closed
petrynchyn opened this issue Oct 17, 2017 · 1 comment
Closed

sample HttpServer_WebSockets does not work #1262

petrynchyn opened this issue Oct 17, 2017 · 1 comment
Labels

Comments

@petrynchyn
Copy link
Contributor

petrynchyn commented Oct 17, 2017

sample HttpServer_WebSockets not work. The impression that the server is not responding to initialize the connection from the browser.
log in in chrome

WebSocket connection to 'ws://192.168.1.60/ws' failed: Error during WebSocket handshake: Invalid status line
testWebSocket @ (index):20
init @ (index):14

log in terminal

petrynchyn@ubuntu:/opt/wshf/Projects/HttpServer_WebSockets$ make clean
petrynchyn@ubuntu:/opt/wshf/Projects/HttpServer_WebSockets$ make
DEP app/CUserData.cpp
C+ app/CUserData.cpp
DEP app/application.cpp
C+ app/application.cpp
AR out/build/app_app.a
LD out/build/app.out

#Memory / Section info:
------------------------------------------------------------------------------
   Section|                   Description| Start (hex)|   End (hex)|Used space
------------------------------------------------------------------------------
      data|        Initialized Data (RAM)|    3FFE8000|    3FFE8384|     900
    rodata|           ReadOnly Data (RAM)|    3FFE8390|    3FFEAF8C|   11260
       bss|      Uninitialized Data (RAM)|    3FFEAF90|    3FFF1CE8|   27992
      text|            Cached Code (IRAM)|    40100000|    401067E0|   26592
irom0_text|           Uncached Code (SPI)|    4020A000|    4024DD10|  277776
Total Used RAM : 40152
Free RAM : 41768
Free IRam : 6194
------------------------------------------------------------------------------
# Generating image...
Generate firmware images successully in folder out/firmware.
Done
# Generating spiffs_bin
Checking for spiffs files
files directory exists. Creating out/firmware/spiff_rom.bin
Creating rom 'out/firmware/spiff_rom.bin' of size 0x10000 (65536) bytes.
Adding files in directory 'files'.
Added 'index.html' to spiffs (1639 bytes).
out/firmware/spiff_rom.bin---------->0x4E000
petrynchyn@ubuntu:/opt/wshf/Projects/HttpServer_WebSockets$ make flash
Killing Terminal to free /dev/ttyUSB0
/opt/Sming/Sming/Makefile-project.mk:495: спроба виконання рецепта для мети «flash» зазнала невдачі
make: [flash] Вбито (ігнорується)
/opt/esp-open-sdk/esptool/esptool.py -p /dev/ttyUSB0 -b 115200 write_flash -ff 40m -fm qio -fs 32m 0x00000 out/firmware/0x00000.bin 0xa000 out/firmware/0xa000.bin 0x4E000 out/firmware/spiff_rom.bin
esptool.py v1.2
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0040
Writing 40960 @ 0x0... 40960 (100 %)
Wrote 40960 bytes at 0x0 in 3.5 seconds (92.4 kbit/s)...
Writing 278528 @ 0xa000... 278528 (100 %)
Wrote 278528 bytes at 0xa000 in 24.0 seconds (92.7 kbit/s)...
Writing 65536 @ 0x4e000... 65536 (100 %)
Wrote 65536 bytes at 0x4e000 in 5.7 seconds (92.6 kbit/s)...
Leaving...
python -m serial.tools.miniterm /dev/ttyUSB0 115200 
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
��␃�␓�o��r��g|�␄d␄lll`␃��s�d��timeout updating: 70 -> 65535
Server timeout updating: 40 -> 0
fs.start: size:3768 Kb, offset:0x4e000

mount res: 0

Station configuration is: MKVL
mode : sta(60:01:94:2b:ae:0b)
add if0
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 2
cnt 

connected with MKVL, channel 3
dhcp client start...
connect to ssid MKVL, channel 3

ip:192.168.1.60,mask:255.255.255.0,gw:192.168.1.1
ip:192.168.1.60,mask:255.255.255.0,gw:192.168.1.1


+TCP connection
'/' registered
'*' registered

=== WEB SERVER STARTED ===
192.168.1.60
==============================

pm open,type:2 0
onAccept state: 0 K=0
Free heap size=37192, K=0
+TCP connection
Opening connection. Total connections: 1
timeout updating: 70 -> 0
TcpServer onClient: 192.168.1.8

The headers are complete
attached file: index.html (1639 bytes)
Storing 17 bytes in stream
realloc 17 -> 171
Storing 25 bytes in stream
Storing 22 bytes in stream
Storing 24 bytes in stream
Storing 26 bytes in stream
Storing 2 bytes in stream
onReadyToSendData: 1
Written: 116, Available: 116, isFinished: 1, PushCount: 1 [TcpBuf: 2664]
TcpClient request completed
TCP received: 392 bytes
onReadyToSendData: 1
READ Template (0)
plain template text pos: 0, len: 1024
Written: 1024, Available: 1024, isFinished: 0, PushCount: 1 [TcpBuf: 1640]
READ Template (0)
plain template text pos: 1024, len: 615
Written: 615, Available: 615, isFinished: 1, PushCount: 2 [TcpBuf: 1025]
TcpClient request completed
TCP sent: 1755
onReadyToSendData: 2
TCP connection closed by timeout: 1 (from 0)
Closing connection. Total connections: 0
TCP connection closing
~TCP connection
-TCP connection
onAccept state: 0 K=0
Free heap size=37184, K=0
+TCP connection
Opening connection. Total connections: 1
timeout updating: 70 -> 0
TcpServer onClient: 192.168.1.8

The headers are complete
Storing 2 bytes in stream
realloc 2 -> 159
Storing 28 bytes in stream
timeout updating: 0 -> 65535
Storing 34 bytes in stream
Storing 21 bytes in stream
Storing 20 bytes in stream
Storing 52 bytes in stream
realloc 157 -> 305
Storing 19 bytes in stream
Storing 26 bytes in stream
Storing 2 bytes in stream
onReadyToSendData: 1
Written: 204, Available: 204, isFinished: 1, PushCount: 1 [TcpBuf: 2576]
TcpClient request completed
TCP received: 526 bytes
onReadyToSendData: 1
TCP sent: 204
onReadyToSendData: 2


@petrynchyn
Copy link
Contributor Author

petrynchyn commented Oct 17, 2017

stopped working after commit git checkout a1ac636bb691ad02c7d5e699a6da8a4cc9c592e7 (Simplified and improved Http Client and Http Server stream handling (#1247))

@slaff slaff added the Bug label Oct 17, 2017
slaff pushed a commit to slaff/Sming that referenced this issue Oct 17, 2017
- Fixes SmingHub#1262
- Fixed memory leak(s).
Core: Added "endless" memory stream.
slaff added a commit that referenced this issue Oct 18, 2017
- Fixes #1262
- Fixed memory leak(s).
Core: Added "endless" memory stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants