- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to make use of server side events (SSE), and have compiled/run the example on a CYW943907AEVAL1F eval board: snip/http_server_sent_events
(Side note: I can get it to run reliably once I comment out the line "wiced_rtos_delay_milliseconds(300 * (unsigned int)random_initial);" in sntp.c. -- Minor issue).
Now, I can see the time updates being sent to the browser page and it all appears to work well:
This webpage demonstrates how a webserver notifies its clients using Server-Sent Event (SSE).
2018-12-29T18:06:38.388000Z
2018-12-29T18:06:39.388000Z
2018-12-29T18:06:40.388000Z
2018-12-29T18:06:41.388000Z
...etc
However, when I close the browser page, then the server crashes and reboots. Apparently it is crashing in the function wiced_http_response_stream_write in the function wiced_result_t send_event:
static wiced_result_t send_event( void* arg )
{
wiced_iso8601_time_t current_time;
char time_string[28];
wiced_result_t result;
UNUSED_PARAMETER( arg );
if ( http_event_stream == NULL )
{
WPRINT_APP_INFO( ( "No stream!\n" ) );
return WICED_ERROR;
} else {
WPRINT_APP_INFO( ( "Event stream is present...good!\n" ) );
}
/* SSE is prefixed with "data: " */
result = wiced_http_response_stream_write( http_event_stream, (const void*)EVENT_STREAM_DATA, sizeof( EVENT_STREAM_DATA ) - 1 ); <- it croaks here
...
}
The console output is:
Event stream is present...good!
...the web page is closed, then the processor croaks and reboots...
Starting WICED vWiced_006.002.001.0002
Platform CYW943907AEVAL1F initialised
Started ThreadX v5.8
Initialising NetX_Duo v5.10_sp3
Creating Packet pools
...etc
I think the function wiced_http_response_stream_write should be robust against client page closure. For some reason it isn't happy. I am wondering if anyone has seen this behaviour, and if so, what their solution might have been?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for pointing out this issue. I will raise this feature addition request internally to make wiced_http_response_stream_write robust against client page closure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for pointing out this issue. I will raise this feature addition request internally to make wiced_http_response_stream_write robust against client page closure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to say if this has made it into the dev plan (>1 yr old, now)?