Skip to content
Projekte

ioBroker/ioBroker.socketio

Auf GitHub ansehen

Über uns

DEPRECATED: socket.io is no longer supported by ioBroker. Use ioBroker.ws instead.

Produktivität und Automatisierung

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
-1
in 15 days
-1
in 1 month
-1

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Logo

ioBroker socket.io

Number of Installations Number of Installations NPM version Downloads

NPM

[!WARNING] Deprecated. socket.io is no longer supported by ioBroker, and this adapter is not developed further. It will be removed from the repository. Use the adapter ws (pure web sockets) instead: its client has the API of socket.io. The web adapter has its own socket since version 10 and no longer uses a socketio instance.

This adapter is used by WEB applications and adapters to communicate with ioBroker using websockets and the socket.io protocol.

Important Note: Since v4.0 of this adapter, pure Websockets are used exclusively! Socket.io is no longer implemented by the socket.io library but simulated via pure WebSockets!

Users can use this adapter to connect their products to ioBroker via web sockets. Actually, this adapter could be used by echarts, vis and many other adapters to extract data from ioBroker.

If possible, please use iobroker.ws instead of this adapter.

You can find in the example directory the simple application that uses this interface to show some data.

By using of socket.io interface user should understand the basics and concept of the system.

It is useful to read about the structure of the objects too.

This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers. For more details and for information on how to disable the error reporting, see Sentry-Plugin Documentation! Sentry reporting is used starting with js-controller 3.0.

Brief description of the concept

Object

Object is a description of a data point or group. The group could content other data points in this case it called a channel. If a group consists of other channels, in this case it is called a device.

Object is meta-information that describes data point and could content: max/min value, unit, name, default value, type of value, information for adapter for communication (e.g., ip address) and so on.

State

State is the actual value of the data point and presented by a JavaScript object:

{
    val: VALUE, 
    ack: ACKNOWLEDGED, 
    ts: TIMESTAMP, // could be converted into time with "new Date(state.ts)" (In older version of js-controller - "new Date(state.ts * 1000)")
    lc: TIMESTAMP of last change, 
    from: ADAPTER_NAME, 
    q: QUALITY
}

States change themselves very frequently in comparison to the objects. (Normally objects should be changed once by creation, and that's all)

Acknowledgment

Every state has the attribute ack. It shows the direction of command.

  • If ack=false, it means some other adapter wants to control (write) this variable, so that command will be executed (e.g., light will be switched on).
  • If ack=true, it means that the device informs about new value. (e.g., light was switched on manually, or motion was detected)

Example: we have some home automation adapter (HAA) that has one lamp connected under address haa.0.lamp1.

  • Lamp can be switched on manually with a physical switch or via Wi-Fi with the help of HAA.
  • If vis wants to switch the lamp on via Wi-Fi, it should set the new value with {value: true, ack: false}.
  • When the lamp is switched on it is normally informing HAA about new state and the value should be immediately overwritten with {value: true, ack: true}.
  • If the lamp is switched off manually via physical switch it informs HAA about new state with {value: false, ack: true}.

Quality

Every data point has an attribute q - quality.

Usage

You can find the description of every supported method here.

It is suggested to use socket class for communication.

Tuning Web-Sockets

On some web-sockets clients, there is a performance problem with communication. Sometimes this issue is due to the fallback of socket.io communication on a long polling mechanism. You can set the option Force Web-Sockets to force using only web-sockets transport.

Ping interval and Ping timeout (in ms, default 120000 and 30000) define how fast a lost connection is detected. With the defaults, a client may show frozen values for up to 2.5 minutes after the server is gone, e.g. after a failover to another host. Smaller values (e.g. 10000 and 5000) detect it sooner, at the cost of one ping per client per interval. Values below 1000 ms are raised to 1000 ms.

Changelog

9.2.0 (2026-12-02)

  • (@GermanBluefox) Deprecated: socket.io is no longer supported by ioBroker, and this adapter is not developed further. Use the adapter ws instead; web 10 has its own socket and no longer uses a socketio instance. The adapter warns about it in the log at start

9.1.0 (2026-11-30)

  • (@AlanSRU) Added the settings Ping interval and Ping timeout of socket.io (defaults unchanged: 120000/30000 ms), see ioBroker/socketio-package#25
  • (@GermanBluefox) Improved authentication
  • (@GermanBluefox) Updated packages

9.0.2 (2026-10-13)

  • (@GermanBluefox) The listening port is reported to the registry of used resources of js-controller 8. Added @iobroker/webserver as a direct dependency
  • (@GermanBluefox) Admin 7.6.20+ is required. Added Ukrainian and missing translations. Compact mode no longer can exit the whole host process
  • (@GermanBluefox) Added socket.io as a direct dependency to fix the crash "socketClass is not a constructor" (#302)

9.0.0 (2026-09-24)

  • (iobroker-bot) Adapter requires node.js >= 22 now.
  • (@GermanBluefox) Updated packages

8.0.2 (2026-08-31)

  • (@GermanBluefox) Updated packages

Older changelogs can be found there

License

The MIT License (MIT), see LICENSE

Copyright (c) 2014-2026 @GermanBluefox [email protected]

Ähnliche Projekte entdecken

Wird geladen…