Difference between optoisolator(optocoupler) and solid state relay?

I have been looking into relays and optoisolators. I am aware that there are different optoisolators, with some having a transistor on the detector side which allows current to flow in one direction whilst there are others with triacs on the detector side to allow current to flow in both directions:

Upon reading up on relays, I found that they work in a similar manner but using mechanical switching using electromagnets to isolate the two sides of the circuit.

I would have then expected solid state relays to be a sub category of relays, but when I looked them, by defintion they perform the same function as an optoisolator.

What is the difference between an optoisolator and a solid state relay, if any? Which is a sub category of which and what are the differences in terms of speed and applications?

Opto-isolators are designed to switch a small amount of current. A solid-state relay typically contains an opto-isolator along with some circuitry to switch a large amount of current in response to the small current switched by the opto-isolator.

I would have then expected solid state relays to be a sub category of relays, but when I looked them, by defintion they perform the same function as an optoisolator.

Relays are mechanical and until the advent of solid-state electronics they were the best practical way to switch high-power loads on and off. Eventually wear and tear will result in failure of the mechanism or the contacts will wear out - particularly if they spark. Note that relays provide electrical isolation between the control circuit (which operates the coil) and the load (switched by the contacts). This is clearly shown in the schematic symbol.

simulate this circuit – Schematic created using CircuitLab

Another problem with the relay is that switching is asynchronous with the mains. Switching on or interrupting power at mid cycle is the worst case for the contacts and for generating electrical noise.

The solid-state relay (SSR) addresses these problems by the optional inclusion of a zero-cross detection circuit so that power is only switched on when voltage is zero and they nearly all will finish off the current half-cycle when the control signal is turned off. With no moving parts the device should never wear out and, as you correctly stated, the control circuit is isolated from the load.

What is the difference between an optoisolator and a solid state relay, if any? Which is a sub category of which and what are the differences in terms of speed and applications?

Opto-isolators are used for signal isolation between circuits in the mA range. SSRs are used to switch power in the amps range (0.1 to hundreds).

One disadvantage with SSRs is that, when on, a little voltage is dropped across them and they dissipate some heat. For more than a couple of amps a heatsink is required.

Most common solid state relays use back-to-back series MOSFETs as the power switching element allowing them to deal with AC. To get a good drive voltage to the isolated gate a photo-voltaic cell is used and this is a significant difference - the LED in the coupling produces light and this generates several volts DC in the photo-voltaic cell to strongly activate the channels of the MOSFETs.

These types of solid state relay tend to be a bit slow at switching and there can be a significant power dissipation when turning on or off but, solid state relays tend to be used as on/off controls like mechanical switches and are usually not operated with a PWM signal.