WebSocket send message before test ending

That’s one of the approaches, yes. The other would be to use per-vu-iterations in options as per the second half of Ned’s post here. With that approach, you just need to be careful with the timeouts you set, which are subsequently used to determine appropriate startTime, duration, and maxDuration values (these combined are what allow you to run scenarios sequentially).