Yes, that connection of hubs / controllers with optical communication is possible as long as it cannot be used to transfer information from outside the robot.
This will not be considered a wireless communication as mentioned in rule 5.6.
If used, teams have to make sure that both hubs / controllers are stopped, when pressing the stop button.