Giter Club home page Giter Club logo

esp8266-websocketclient's Introduction

esp8266-websocketclient

ESP8266 WebsocketClient

Un simple cliente basado en eventos de websocket para el ESP8266, con soporte de los protocolos ws y wss.

Funciones

  • Non-blocking action, al funcionar con eventos no requiere esperar a que una condición se de para ejecutar alguna acción.
  • Heartbeat utilizando las funcionaes de PING PONG del protocolo de websocket.

Ejemplo:

#include <Arduino.h>
#include "WebSocketClient.h"
#include "ESP8266WiFi.h"

WebSocketClient ws(true);

void wListener(char *payload, size_t length)
{
	for (int i = 0; i < length; i++)
	{
		Serial.print(payload[i]);
	}
	Serial.println();

	ws.send("Response");
}

void setup()
{
	Serial.begin(115200);
	WiFi.begin("MyWifi", "secret");

	Serial.print("Connecting");
	while (WiFi.status() != WL_CONNECTED)
	{
		delay(500);
		Serial.print(".");
	}
	ws.begin("echo.websocket.org", "/", 443);
	ws.setTimeOut(15000);
	ws.setEvent(wListener);
}

void loop()
{
	ws.loop();
}

esp8266-websocketclient's People

Contributors

akatormr avatar estradiaz avatar hellerchr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.