How the openhab connector works

Hello dear community

I have a question wanted to ask what the basic function of the connector is?

I know that it has something to do with websocket, that the standard port is used, and that a tunnel is set up in reverse. is it a standard procedure? is there a representation?

I would like to adapt the function.

If anyone could help me then I would be incredibly grateful

It is not exactely websocket, openhabcloud end uses npm/js hence it has some socket.io stuff which can downgrade connection to other mechanis than websocket. In practice it is websocket.

Role of connector is quite basic - it opens connection to remote server and then waits for calls/commands on opened channel. These commands coming from server are usually forwarded HTTP calls which are used to instruct embedded http client to call localhost:8080. Answers are being sent back to server using same channel. By this way your OH is accessible through cloud server.
There is second form of communication - a event stream published by OH to myopenhab with item states (AFAIR) and notifications which are then dispatched by myopenhab cloud.

1 Like

Thank you very much for the quick answer, that helped me