ESP8266 Developer Zone The Official ESP8266 Forum 2016-11-06T10:56:58+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1534 2016-11-06T10:56:58+08:00 2016-11-06T10:56:58+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=10417#p10417 <![CDATA[Re: RTOS problem with nopoll websockets]]> 试了wss://iot.espressif.cn:9443改为ws://iot.espressif.cn:9000,都连不上。
espressif的云端不支持websocket了?

Statistics: Posted by JasonWan — Sun Nov 06, 2016 10:56 am


]]>
2016-11-06T10:53:23+08:00 2016-11-06T10:53:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=10416#p10416 <![CDATA[ESP8266 RTOS SDK v1.4.0 websocke连不上]]> 单独测试连接ws://iot.espressif.cn:9000也连不上,难道espressif的云端现在不支持websocket了?

Statistics: Posted by JasonWan — Sun Nov 06, 2016 10:53 am


]]>
2016-01-23T14:25:52+08:00 2016-01-23T14:25:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=5492#p5492 <![CDATA[Re: RTOS problem with nopoll websockets]]>
execute xtensa-lx106-elf-objcopy -W nopoll_conn_produce_accept_key libnopoll.a libnopoll2.a

Edit makefile to link libnopoll2.a (instead of the default one).

Put the following in your source code (or just a new .c file);

Code:

include <nopoll/nopoll.h>
#include "ssl_compat-1.0.h"
#include "esp_common.h"

char ICACHE_FLASH_ATTR * nopoll_conn_produce_accept_key(noPollCtx * ctx, const char * websocket_key)
{
  if(websocket_key == NULL) return;

  const char * static_guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
  char * accept_key = NULL;
  int accept_key_size, key_length;

  key_length = strlen(websocket_key);

  unsigned char buffer[SHA1_SIZE];
  SHA1_CTX mdctx;
  unsigned int md_len = SHA1_SIZE;

  accept_key_size = key_length + 36 + 1;
  accept_key      = nopoll_new(char, accept_key_size);

  memcpy(accept_key, websocket_key, key_length);
  memcpy(accept_key + key_length, static_guid, 36);

  SHA1_Init(&mdctx);
  SHA1_Update(&mdctx, accept_key, strlen(accept_key));
  SHA1_Final(buffer, &mdctx);

  nopoll_base64_encode((const char *)buffer, md_len, (char *)accept_key, &accept_key_size);

  return accept_key;
}

bool ICACHE_FLASH_ATTR check_websocket_auth_response(bool print)
{
  bool result = FALSE;
  char * expected_result = "HSmrc0sMlYUkAGmm5OPpG2HaGWk="; //Wikipedia Sample Response
  char * websocket_key_test = nopoll_conn_produce_accept_key(NULL, "x3JJHMbDL1EzLkh9GBhXDw=="); //Wikipedia Sample   
  if(memcmp(expected_result, websocket_key_test, 28) == 0) result = TRUE;
  if(print) printf("Websocket Auth Response %s\nExpected: %s\nReturned: %s\n", result ? "Passed" : "Failed", expected_result, websocket_key_test);
  nopoll_free(websocket_key_test);
  return result;
}


works great!!

Statistics: Posted by dsbaha — Sat Jan 23, 2016 2:25 pm


]]>
2016-01-22T15:23:52+08:00 2016-01-22T15:23:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=5483#p5483 <![CDATA[Re: RTOS problem with nopoll websockets]]> Statistics: Posted by dsbaha — Fri Jan 22, 2016 3:23 pm


]]>
2016-01-04T13:53:32+08:00 2016-01-04T13:53:32+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=5227#p5227 <![CDATA[Re: RTOS problem with nopoll websockets]]>
Sorry for the inconvenience.

Please have a try with this new demo as the attachment.
websocket_demo.zip

Statistics: Posted by ESP_Faye — Mon Jan 04, 2016 1:53 pm


]]>
2015-12-31T16:37:32+08:00 2015-12-31T16:37:32+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=5206#p5206 <![CDATA[Re: RTOS problem with nopoll websockets]]>
also, the libnopoll will not work, because it won't generate the handshake key correctly. Why do I know this, simply build and run the following code:

extern char * nopoll_conn_produce_accept_key(noPollCtx * ctx, const char * websocket_key);
char* key = nopoll_conn_produce_accept_key(ctx, "3WazH0uwf9nfcy5VNmasrw==");
printf("KEY:%s\n", key);
nopoll_free(key);

The expected result response key should be "yKyGAgJvgbG9GY8gjdicbpl3HWs=", but it actually returns "udQnQPAff9nfcy5VNmasrw==258EAFA5-E914-47DA-95CA-C5AB0DC85B11". Why is that? Because the libnopoll.a is compiled with wrong SHA1 result buffer size, which is defined as "ESP_EVP_MAX_MD_SIZE6". It should be at least 20.

Since I don't have access to the code,I don't know if there is any other errors, but please, when you release an "SDK" with examples, build and run them!

this is totally a waste of time!

Statistics: Posted by faintu — Thu Dec 31, 2015 4:37 pm


]]>
2015-12-21T11:25:08+08:00 2015-12-21T11:25:08+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=5109#p5109 <![CDATA[Re: RTOS problem with nopoll websockets]]>
Could it work with Espressif Cloud ?

Statistics: Posted by ESP_Faye — Mon Dec 21, 2015 11:25 am


]]>
2015-12-19T18:29:52+08:00 2015-12-19T18:29:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1534&p=5097#p5097 <![CDATA[RTOS problem with nopoll websockets]]> someone tested nopoll lib. I can't establish connection with nopoll_conn_new() - every time i get error.
For example
conn = nopoll_conn_new(ctx, "echo.websocket.org", "80", "echo.websocket.org:80", "ws://echo.websocket.org:80/", NULL, "null");

this work without problem with nopoll lib under windows. but on ESP with latest RTOS not. And the example included also not work.


br
harry

Statistics: Posted by harryzz — Sat Dec 19, 2015 6:29 pm


]]>