When I was developing my “All notes off” ReaJS script, I tried the midiSostenuto plugin from pizMIDI and it seemed to work quite well. Anyway, @Ade certainly knows more than me about it.
Gabriel
P.S. Here is the thread about the “All notes off” script and the interaction with midiSostenuto