diff --git a/source/server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.rst b/source/server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.rst index 66e171ddfb..1232e2c964 100644 --- a/source/server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.rst +++ b/source/server-discovery-and-monitoring/server-discovery-and-monitoring-logging-and-monitoring.rst @@ -138,7 +138,7 @@ Events that MUST be published (with their conditions) are as follows. * - ``TopologyClosedEvent`` - When a topology is shut down - this MUST be the last SDAM event fired. * - ``ServerHeartbeatStartedEvent`` - - Published when the server monitor sends its ``hello`` or legacy hello call to the server. + - Published when the server monitor sends its ``hello`` or legacy hello call to the server. When the monitor is creating a new connection, this event MUST be published just before the socket is created. * - ``ServerHeartbeatSucceededEvent`` - Published on successful completion of the server monitor's ``hello`` or legacy hello call. * - ``ServerHeartbeatFailedEvent`` @@ -251,6 +251,8 @@ Events that MUST be published (with their conditions) are as follows. /** * Fired when the server monitor's ``hello`` or legacy hello command is started - immediately before * the ``hello`` or legacy hello command is serialized into raw BSON and written to the socket. + * When the monitor is creating a new monitoring connection, this event is fired just before the + * socket is opened. */ interface ServerHeartbeatStartedEvent { @@ -696,6 +698,7 @@ See the `README { + events.push('client connected'); + + clientSocket.on('data', () => { + events.push('client hello received'); + clientSocket.destroy(); + }); + }); + server.listen(9999); + + #. Create a client with ``serverSelectionTimeoutMS: 500`` and listen to ``ServerHeartbeatStartedEvent`` and ``ServerHeartbeatFailedEvent``, pushing the event name to the same shared array as the mock TCP server + + #. Attempt to connect client to previously created TCP server, catching the error when the client fails to connect + + #. Assert that the first four elements in the array are: :: + + ['serverHeartbeatStartedEvent', 'client connected', 'client hello received', 'serverHeartbeatFailedEvent'] + .. Section for links. .. _Server Description Equality: /source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#server-description-equality