All Projects → timum-viw → Socket.io Client

timum-viw / Socket.io Client

A socket.io-client implementation for ESP8266 and Arduino

Projects that are alternatives of or similar to Socket.io Client

Arduinowebsockets
A library for writing modern websockets applications with Arduino (ESP8266 and ESP32)
Stars: ✭ 213 (+25.29%)
Mutual labels:  arduino, arduino-library, websockets, esp8266
Espui
A simple web user interface library for ESP32 and ESP8266
Stars: ✭ 330 (+94.12%)
Mutual labels:  arduino, arduino-library, websockets, esp8266
Arduino Homekit Esp8266
Native Apple HomeKit accessory implementation for the ESP8266 Arduino core.
Stars: ✭ 545 (+220.59%)
Mutual labels:  arduino, arduino-library, esp8266
Arduinojson
📟 JSON library for Arduino and embedded C++. Simple and efficient.
Stars: ✭ 5,456 (+3109.41%)
Mutual labels:  arduino, arduino-library, esp8266
Easyntpclient
Library to read time from Network Time Protocol (NTP) servers.
Stars: ✭ 20 (-88.24%)
Mutual labels:  arduino, arduino-library, esp8266
Pzem004t
Arduino communication library for Peacefair PZEM-004T Energy monitor
Stars: ✭ 165 (-2.94%)
Mutual labels:  arduino, arduino-library, esp8266
Guislice
GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
Stars: ✭ 534 (+214.12%)
Mutual labels:  arduino, arduino-library, esp8266
Ewma
Exponentially Weighted Moving Average Filter
Stars: ✭ 21 (-87.65%)
Mutual labels:  arduino, arduino-library, esp8266
Blinker Library
An IoT Solution,Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.
Stars: ✭ 1,095 (+544.12%)
Mutual labels:  arduino, websockets, esp8266
Aunit
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test. Used with AUniter or EpoxyDuino for continuous builds.
Stars: ✭ 73 (-57.06%)
Mutual labels:  arduino, arduino-library, esp8266
Tft espi
Arduino and PlatformIO IDE compatible TFT library optimised for the STM32, ESP8266 and ESP32 that supports different driver chips
Stars: ✭ 1,215 (+614.71%)
Mutual labels:  arduino, arduino-library, esp8266
Espmqttclient
Wifi and MQTT handling for ESP8266 and ESP32
Stars: ✭ 169 (-0.59%)
Mutual labels:  arduino, arduino-library, esp8266
Heatpump
Arduino library to control Mitsubishi Heat Pumps via connector cn105
Stars: ✭ 327 (+92.35%)
Mutual labels:  arduino, arduino-library, esp8266
Ssd1306
Driver for SSD1306, SSD1331, SSD1351, IL9163, ILI9341, ST7735, PCD8544, Nokia 5110 displays running on Arduino/ESP32/Linux (Rasperry) platforms
Stars: ✭ 303 (+78.24%)
Mutual labels:  arduino, arduino-library, esp8266
Button2
Arduino Library to simplify working with buttons. It allows you to use callback functions to track single, double, triple and long clicks. It also takes care of debouncing.
Stars: ✭ 109 (-35.88%)
Mutual labels:  arduino, arduino-library, esp8266
Esp8266 Weather Station
ESP8266 Weather Station library supporting OpenWeatherMap, Aeris and other sources
Stars: ✭ 822 (+383.53%)
Mutual labels:  arduino, arduino-library, esp8266
Blynk Server
Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes
Stars: ✭ 8 (-95.29%)
Mutual labels:  arduino, websockets, esp8266
Dsckeybusinterface
An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
Stars: ✭ 202 (+18.82%)
Mutual labels:  arduino, arduino-library, esp8266
Ws2812fx
WS2812 FX Library for Arduino and ESP8266
Stars: ✭ 1,113 (+554.71%)
Mutual labels:  arduino, arduino-library, esp8266
Arduinowebsockets
arduinoWebSockets
Stars: ✭ 1,265 (+644.12%)
Mutual labels:  arduino-library, websockets, esp8266

This library is deprecated. You can directly use the WebSockets library (https://github.com/Links2004/arduinoWebSockets). It supports a SocketIOclient class. See the example there.

socket.io-client

A socket.io-client implementation for ESP8266 and Arduino.

Index

Install

💡 This library uses lstdc++

To compile you have to add a reference to the linker. To do so edit platform.txt in $ARDUINO_IDE/hardware/esp8266com/esp8266 and add '-lstdc++' to the line

compiler.c.elf.libs= ...

💡 Note: See ESP8266 for Arduino IDE (xtensa-lx106-elf-gcc) and std::map linking error.

Add library

Best thing is to use the Arduino Library Manager.

  1. Go to Sketch > Include Library > Manage Libraries.
  2. Install WebSockets by Markus Sattler
  3. Install SocketIoClient
  4. Select Sketch > Include Library > SocketIoClient

Functions

  1. SocketIoClient::begin()
  2. SocketIoClient::beginSSL()
  3. SocketIoClient::disconnect()
  4. SocketIoClient::emit()
  5. SocketIoClient::loop()
  6. SocketIoClient::on()
  7. SocketIoClient::remove()
  8. SocketIoClient::setAuthorization()

SocketIoClient::begin(host[, port, path])

Open connection to socket.io server.

Parameter

host url to socket.io server port port to connect on. Defaults to 80 or 443 (SSL) path path to connect to on server. Defaults to "/socket.io/?transport=websocket"

Example
socket.begin("my.socket-io.server", 443, "/socket.io/?transport=websocket");

SocketIoClient::beginSSL(host[, port, path, fingerprint])

Open SSL connection to socket.io server.

Parameter

host url to socket.io server port port to connect on. Defaults to 80 or 443 (SSL) path path to connect to on server. Defaults to "/socket.io/?transport=websocket" fingerprint the SSL fingerprint. Defaults to ""

Example
socket.beginSSL("my.socket-io.server", 443, "/socket.io/?transport=websocket", "26 96 1C 2A 51 07 FD 15 80 96 93 AE F7 32 CE B9 0D 01 55 C4");

SocketIoClient::disconnect()

Disconnect from the server.

Example
socket.disconnect();

SocketIoClient::emit(event, payload)

Emits an event to the server.

Parameter

event name of the event to be emitted payload string of the payload to be sent with the event. Plain strings and object property names should be encapsulated in quotes.

Example
socket.emit("plainString", "\"this is a plain string\"");
socket.emit("jsonObject", "{\"foo\":\"bar\"}");

SocketIoClient::loop()

Processes the websocket. Should be called in Arduino main loop.

SocketIoClient::on(event, callback)

Binds a function to an event.

Parameter

event name of the event to bind to callback callback function to call when the event is triggered Function signature must be

void (const char * payload, size_t length)
Example
void event(const char * payload, size_t length) {
	// do stuff
}
socket.on("event", event);
Supported default events:
  • connect - when user is connected to server
  • disconnect - when user is disconnected from the server

SocketIoClient::remove(event)

Removes the previously added event.

Parameter

event name of the event binded

Example
socket.remove("event");

SocketIoClient::setAuthorization(username, password)

Set HTTP Basic auth username and password.

Example
socket.setAuthorization("username", "password");

Miscellaneous

To go along with the socket.io-client implementation of socket.io the connect event is triggered upon successfully opened connection to server. To utilize simply add

socket.on("connect", handler)

Likewise, disconnect event is triggered upon terminated connection.

Example

See Example

Contribution

Based on the great work of Links2004 / arduinoWebSockets.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].