first steps to Client

This commit is contained in:
Markus Sattler
2015-05-23 23:51:32 +02:00
parent cf54518bc9
commit b5dbeccdf5
6 changed files with 394 additions and 10 deletions

View File

@ -38,6 +38,7 @@ extern "C" {
* @param reasonLen
*/
void WebSockets::clientDisconnect(WSclient_t * client, uint16_t code, char * reason, size_t reasonLen) {
DEBUG_WEBSOCKETS("[WS-Server][%d][handleWebsocket] clientDisconnect code: %u\n", client->num, code);
if(client->status == WSC_CONNECTED && code) {
if(reason) {
sendFrame(client, WSop_close, (uint8_t *) reason, reasonLen);
@ -60,6 +61,10 @@ void WebSockets::clientDisconnect(WSclient_t * client, uint16_t code, char * rea
*/
void WebSockets::sendFrame(WSclient_t * client, WSopcode_t opcode, uint8_t * payload, size_t length) {
if(!client->tcp.connected()) {
return;
}
uint8_t buffer[16] = { 0 };
uint8_t i = 0;