selenium.grid.server.hub
The grid hub: request router, node registry, and session ownership map.
Hub
class Hub;
The grid entry point that routes requests and tracks the node registry.
A Hub is the coordinator analog of selenium.bridge.Bridge: where a Bridge
owns WebDriver sessions on one process, a Hub owns node registrations across
many processes. It does not host WebDriver sessions itself. It forwards new
session requests to a matching node and tracks which node owns each session.
secret
string secret;
The registration secret required by secured grid endpoints, or null.
router
Router router;
The route table populated with every grid endpoint.
nodes
NodeInfo[string] nodes;
Registered nodes keyed by node id, mapped to their last reported status.
sessions
SessionInfo[string] sessions;
Active sessions keyed by session id, mapped to their owning node.
start
static Hub start(ushort port = 4444, string secret = null);
Configures a hub on the given port and registers its route table.
The hub does not accept connections until a server loop is attached. This keeps configuration independent from the transport so the routing surface can be exercised and tested without sockets.
Parameters:
| Name | Description |
|---|---|
ushort port |
The port the hub advertises in its address. |
string secret |
The registration secret, or null for an open grid. |
Returns: A configured hub with routes registered.
stop
void stop();
Releases the route table and node registry. Idempotent.
status
GridStatus status();
The current grid status, built from the node registry.
registerNode
void registerNode(NodeInfo node);
Registers or refreshes a node in the registry.
Forward-thinking seam for the node registration endpoint. The live heartbeat that calls this from a node is not yet wired. (TODO)
Parameters:
| Name | Description |
|---|---|
NodeInfo node |
The node status to record, keyed by its id. |
removeNode
void removeNode(string nodeId);
Removes a node from the registry.
Parameters:
| Name | Description |
|---|---|
string nodeId |
The node id to remove. |