You are assigning e3.Data to the output after the component has been updated, so you need to update it again when you receive the message, something like
ws.OnMessage += (sender3, e3) => { DA.SetData(0, e3.Data); this.ExpireSolution(true); }
but keep in mind that the component (and its downstream components) will run once before receiving the message. Then you have to handle this or prevent the component from completing SolveInstance until it receives the message.
The second strange behavior I think is because you are assigning to the output a data in a phase outside the component’s native flow (after it is updated), leaving behind all the internal processes it needs to do to complete the new update. @DavidRutten can help you hack into this in the right way.