For something simpler, you could try ping also. In my case ping works both ways, I can ping my Librem 5 from my laptop and I can ping the laptop from the Librem 5. But probably ping will also fail for you, as @AN0N is saying it may be that different devices on your network are not allowed to reach each other.
Another test you could do, if you have another laptop at hand, is to see if the two laptops can reach each other using ping and/or ssh. If that does not work, then you know you have an issue with your network that is not related to the Librem 5, but a more general thing.
You could also try with another WiFi network, like at a friend’s house or something, to see if it works there. I don’t know how common it is for devices to be allowed to talk directly like this on a wireless network, I just know that it happens to work with my WiFi at home. (And I guess it seems to work for several other people who have managed to login to their Librem 5 using ssh.)
Now I have the solution It was two problems. The router I used had some isolation, so I tested another one (my iPhone), which worked. Then the problem was with the user which was purism instead of pureos. Thanks everyone for the help!