github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/modules/edge/edgehub.md (about) 1 # Edgehub 2 3 ## Overview 4 5 Edge hub is responsible for interacting with CloudHub component present in the cloud. It can connect to the CloudHub using either a web-socket connection or using [QUIC](https://quicwg.org/ops-drafts/draft-ietf-quic-applicability.html) protocol. 6 It supports functions like sync cloud side resources update, report edged side host and device status changes. 7 8 It acts as the communication link between the edge and the cloud. 9 It forwards the messages received from the cloud to the corresponding module at the edge and vice-versa. 10 11 The main functions performed by edgehub are :- 12 13 - Keep Alive 14 - Publish Client Info 15 - Route to Cloud 16 - Route to Edge 17 18 19 ## Keep Alive 20 21 A keep-alive message or heartbeat is sent to cloudHub after every heartbeatPeriod. 22 23 24 ## Publish Client Info 25 26 - The main responsibility of publish client info is to inform the other groups or modules regarding the status of connection to the cloud. 27 28 - It sends a beehive message to all groups (namely metaGroup, twinGroup and busGroup), informing them whether cloud is connected or disconnected. 29 30 31 ## Route To Cloud 32 33 The main responsibility of route to cloud is to receive from the other modules (through beehive framework), all the 34 messages that are to be sent to the cloud, and send them to cloudHub through the websocket connection. 35 36 The major steps involved in this process are as follows :- 37 38 1. Continuously receive messages from beehive Context 39 2. Send that message to cloudHub 40 3. If the message received is a sync message then : 41 42 3.1 If response is received on syncChannel then it creates a map[string] chan containing the messageID of the message as key 43 44 3.2 It waits for one heartbeat period to receive a response on the channel created, if it does not receive any response on the channel within the specified time then it times out. 45 46 3.3 The response received on the channel is sent back to the module using the SendResponse() function. 47 48  49 50 ## Route To Edge 51 52 The main responsibility of route to edge is to receive messages from the cloud (through the websocket connection) and 53 send them to the required groups through the beehive framework. 54 55 The major steps involved in this process are as follows :- 56 57 - Receive message from cloudHub 58 59 - Check whether the route group of the message is found. 60 61 - Check if it is a response to a SendSync() function. 62 63 - If it is not a response message then the message is sent to the required group 64 65 - If it is a response message then the message is sent to the syncKeep channel 66 67  68 69 70 ## Usage 71 72 EdgeHub can be configured to communicate in two ways as mentioned below: 73 74 - **Through websocket protocol**: Click [here](https://github.com/kubeedge/kubeedge/blob/master/docs/proposals/quic-design.md#edgehub-connect-to-cloudhub-through-websocket-protocol) for details. 75 - **Through QUIC protocol**: Click [here](https://github.com/kubeedge/kubeedge/blob/master/docs/proposals/quic-design.md#edgehub-connect-to-cloudhub-through-quic) for details.