{"action":"created","issue":{"url":"https://api.github.com/repos/Links2004/arduinoWebSockets/issues/12","labels_url":"https://api.github.com/repos/Links2004/arduinoWebSockets/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/Links2004/arduinoWebSockets/issues/12/comments","events_url":"https://api.github.com/repos/Links2004/arduinoWebSockets/issues/12/events","html_url":"https://github.com/Links2004/arduinoWebSockets/issues/12","id":110803762,"number":12,"title":"More than 10 messages a second gives error LmacRxBlk:1","user":{"login":"NardJ","id":11459480,"avatar_url":"https://avatars.githubusercontent.com/u/11459480?v=3","gravatar_id":"","url":"https://api.github.com/users/NardJ","html_url":"https://github.com/NardJ","followers_url":"https://api.github.com/users/NardJ/followers","following_url":"https://api.github.com/users/NardJ/following{/other_user}","gists_url":"https://api.github.com/users/NardJ/gists{/gist_id}","starred_url":"https://api.github.com/users/NardJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NardJ/subscriptions","organizations_url":"https://api.github.com/users/NardJ/orgs","repos_url":"https://api.github.com/users/NardJ/repos","events_url":"https://api.github.com/users/NardJ/events{/privacy}","received_events_url":"https://api.github.com/users/NardJ/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-10T16:31:28Z","updated_at":"2015-10-11T14:30:33Z","closed_at":null,"body":"Using the server example and the html in the test subfolder, the updates (time messages) come in at 1 update every second. If I lower the html polling interval to <100ms it crashes with a message LmacRxBlk:1, which as I understand is a full buffer, but can't find a way to circumvent this. Is this maybe a bug?\r\n\r\nI can't figure out what is wrong. Any help appreciated! \r\nI tried to attach the html code but can't. Below the html with all <> replaced by []\r\n\r\n[html]\r\n[head]\r\n\r\n[script]\r\nvar connection = new WebSocket('ws://192.168.0.13:81/test', ['arduino']);\r\n\r\nconnection.onopen = function () {\r\n   connection.send('Message from Browser to ESP8266 yay its Working!! ' + new Date()); \r\n   connection.send('ping');\r\n   setTimeout(refresh,3000);\r\n};\r\n\r\nconnection.onerror = function (error) {\r\n   console.log('WebSocket Error ', error);\r\n};\r\n\r\nconnection.onmessage = function (e) {\r\n   console.log('Server: ', e.data);\r\n};\r\n\r\nfunction refresh(){\r\n  connection.send('Time: ' + new Date()); \r\n  setTimeout(refresh,50);\r\n}\r\n[/script]\r\n\r\n[/head]\r\n[body]\r\nTest Websocket.\r\n[/body]\r\n[/html]\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Links2004/arduinoWebSockets/issues/comments/147202894","html_url":"https://github.com/Links2004/arduinoWebSockets/issues/12#issuecomment-147202894","issue_url":"https://api.github.com/repos/Links2004/arduinoWebSockets/issues/12","id":147202894,"user":{"login":"starlino","id":13699933,"avatar_url":"https://avatars.githubusercontent.com/u/13699933?v=3","gravatar_id":"","url":"https://api.github.com/users/starlino","html_url":"https://github.com/starlino","followers_url":"https://api.github.com/users/starlino/followers","following_url":"https://api.github.com/users/starlino/following{/other_user}","gists_url":"https://api.github.com/users/starlino/gists{/gist_id}","starred_url":"https://api.github.com/users/starlino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starlino/subscriptions","organizations_url":"https://api.github.com/users/starlino/orgs","repos_url":"https://api.github.com/users/starlino/repos","events_url":"https://api.github.com/users/starlino/events{/privacy}","received_events_url":"https://api.github.com/users/starlino/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T14:30:33Z","updated_at":"2015-10-11T14:30:33Z","body":"Markus, wow ,20ms per packet is great ! Can it be because you're sending packets from computer and it is grouping them into single TCP packet ? But then I can't explain how the response comes back. From my experiments ESP cannot send packets faster then 200ms. However I can send large packets , so I can transfer a lot of data as long as I group them in large packets. It could be because of my router and frame size.\r\n\r\nTo test the real throughput of your ESP I wrote a little test, it basically sends small, then larger and larger packets from ESP to your computer. You must connect to your ESP via telnet and it will run the test. It also shows how you can use a timer (Ticker) to do things in the background while you wait for your packet to be sent. In this example we're simply increment the ticker_count every 10ms.\r\n\r\nIf anyone can run this test and share the results for different packet sizes , it would be great to compare.\r\n\r\nP.S. I found that   server.setNoDelay(false); makes no real difference for me , does it do anything for you ?\r\n\r\n```\r\n#include <ESP8266WiFi.h>\r\n#include <Ticker.h>\r\n\r\n//how many clients should be able to telnet to this ESP8266\r\n#define MAX_SRV_CLIENTS 1\r\nconst char* ssid = \"PUT_YOUR_SSID_HERE\";\r\nconst char* password = \"PUT_YOUR_PASS_HERE\";\r\n\r\nWiFiServer server(23);\r\nWiFiClient serverClient;\r\n\r\n#define BASE_LEN 200\r\n#define STEP_COUNT 8\r\n#define PACKET_COUNT 10\r\n#define BUF_LEN (BASE_LEN*STEP_COUNT)\r\nuint8_t buf[BUF_LEN];\r\nint step_num = 1;\r\nint packet_num = 1;\r\n\r\nTicker ticker;\r\nvolatile unsigned long ticker_count; \r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  WiFi.begin(ssid, password);\r\n\r\n  Serial.print(\"\\nConnecting to \"); Serial1.println(ssid);\r\n  unsigned long i = 0;\r\n  while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);\r\n  if(i == 21){\r\n    Serial.print(\"Could not connect to\"); Serial.println(ssid);\r\n    while(1) delay(500);\r\n  }\r\n  \r\n  server.begin();\r\n  server.setNoDelay(false);\r\n  \r\n  Serial.print(\"Ready! Use 'telnet \");\r\n  Serial.print(WiFi.localIP());\r\n  Serial.println(\" 23' to connect\");\r\n\r\n  for(i=0;i<BUF_LEN;i++){\r\n    buf[i] = 'A' + i % 25;\r\n    if(0 == i % BASE_LEN) buf[i] = '0' + (i / BASE_LEN) % 10 ; \r\n    if((BASE_LEN-2) == i % BASE_LEN) buf[i] = '\\r'; \r\n    if((BASE_LEN-1) == i % BASE_LEN) buf[i] = '\\n';\r\n  }\r\n  \r\n}\r\n\r\n\r\nunsigned long time_start ;\r\n\r\nvoid ticker_callback(){\r\n  ticker_count++; \r\n}\r\n\r\nvoid loop() {\r\n  uint8_t i;\r\n  //check if there are any new clients\r\n  if (!serverClient && server.hasClient()){\r\n    serverClient = server.available();\r\n    serverClient.setNoDelay(false);\r\n  }\r\n  if(step_num > 0 && serverClient && serverClient.connected()){\r\n    size_t len = BASE_LEN*step_num;\r\n    if(1 == packet_num) time_start = millis();\r\n\r\n    ticker_count = 0;\r\n    ticker.attach_ms(10,ticker_callback);\r\n    serverClient.write((const uint8_t *)buf, len);\r\n    ticker.detach();\r\n        \r\n    packet_num++;\r\n    if(PACKET_COUNT < packet_num){\r\n        unsigned long time_delta = millis() - time_start;\r\n        unsigned long BytesPS = PACKET_COUNT* len * 1000;\r\n        BytesPS /= time_delta; \r\n        String str = \"\\r\\n\\r\\n**Packet len=\"+String(len) + \" ms=\" + String(time_delta) + \" Bytes/sec=\" + String(BytesPS) + \" ticker_count=\" + String(ticker_count) +\"\\r\\n\\r\\n\";\r\n\r\n        serverClient.write(str.c_str(), str.length());\r\n    \r\n        \r\n        packet_num = 1;\r\n        step_num++;\r\n        if(STEP_COUNT < step_num){\r\n          str = \"Done\\r\\n\";\r\n          serverClient.write(str.c_str(), str.length());\r\n          step_num = -1; \r\n          serverClient.stop();\r\n        }  \r\n    }\r\n  }\r\n  delay(0);\r\n}\r\n\r\n```\r\n\r\n\r\n\r\n"}}