code: func (s *Socket) sendPing() {
  	// Lock the mutex.
  	s.sendPingMutex.Lock()
  
  	// Check if a ping request is already active.
  	if s.pingRequestActive {
  		// Unlock the mutex again.
  		s.sendPingMutex.Unlock()
  		return
  	}
  
  	// Update the flag and unlock the mutex again.
  	s.pingRequestActive = true
  	s.sendPingMutex.Unlock()
  
  	// Start the timeout timer. This will close
  	// the socket if no pong response is received
  	// within the timeout.
  	// Do this before the write. The write channel might block
  	// if the buffers are full.
  	s.pingTimeout.Reset(pingResponseTimeout)
  
  	// Send a ping request by writing to the stream.
  	s.writeChan <- cmdPing
  }
docs: // SendPing sends a ping to the client. If no pong response is
  // received within the timeout, the socket will be closed.
  // Multiple calls to this method won't send multiple ping requests,
  // if a ping request is already active.