You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to open the instance configuration of an adapter with "adapter-react-v5" in the development server (dev-server), the socket.io connection fails. Consequence: the configuration dialog does not open. You can see this, if you e.g. open the development tool in Chrome (see screenshot at the end) and follow up the error messages returned by the socket.io.js of the ioBroker.admin (path: \dev-server\default\node_modules\iobroker.admin\www\lib\js\socket.io.js).
This behaviour only occurs, with the adapter, that is watched by the development server ! You can reproduce this, if you take a working production adapter like the "[ioBroker.gigaset-element]" (https://github.com/matthsc/ioBroker.gigaset-elements). The adapter is based on adapter-react-v5. If you install the adapter in the dev-server environement with the normal procedure everything works fine. As soon as you download the source and install a dev-server with this, the configuration dialog will not open.
The reason for the described error is the path, that is handed over to the socket.io.
I figured out, that the root cause is in Connection.js of adapter-react-v5 in line 244 (" var pos = path.lastIndexOf('/');"). When using the dev-sever, the path variable at this point of time is "/adapter/ADAPTERNAME/index_m.html". In the following 3 code lines the variable is reduced to "/adapter/ADAPTERNAME/" and is finally handed over to the socket.io interface. Here in the "socket.io.js" in the code line "socket = new WebSocket(u);" the url (u) includes the path. If you remove the the path, everything works fine and the adapter configuration works perfectly.
As a workaround I added the following code directly before the creation of WebSocket in the socket.io.js. With this everything works fine:
if (options && options.path) {
u=u.replace(options.path.replace('/socket.io',''),'')
}
Below the screen shot of the Chrome development tool:
The text was updated successfully, but these errors were encountered:
When trying to open the instance configuration of an adapter with "adapter-react-v5" in the development server (dev-server), the socket.io connection fails. Consequence: the configuration dialog does not open. You can see this, if you e.g. open the development tool in Chrome (see screenshot at the end) and follow up the error messages returned by the socket.io.js of the ioBroker.admin (path: \dev-server\default\node_modules\iobroker.admin\www\lib\js\socket.io.js).
This behaviour only occurs, with the adapter, that is watched by the development server ! You can reproduce this, if you take a working production adapter like the "[ioBroker.gigaset-element]" (https://github.com/matthsc/ioBroker.gigaset-elements). The adapter is based on adapter-react-v5. If you install the adapter in the dev-server environement with the normal procedure everything works fine. As soon as you download the source and install a dev-server with this, the configuration dialog will not open.
The reason for the described error is the path, that is handed over to the socket.io.
I figured out, that the root cause is in Connection.js of adapter-react-v5 in line 244 (" var pos = path.lastIndexOf('/');"). When using the dev-sever, the path variable at this point of time is "/adapter/ADAPTERNAME/index_m.html". In the following 3 code lines the variable is reduced to "/adapter/ADAPTERNAME/" and is finally handed over to the socket.io interface. Here in the "socket.io.js" in the code line "socket = new WebSocket(u);" the url (u) includes the path. If you remove the the path, everything works fine and the adapter configuration works perfectly.
As a workaround I added the following code directly before the creation of WebSocket in the socket.io.js. With this everything works fine:
Below the screen shot of the Chrome development tool:
The text was updated successfully, but these errors were encountered: