terminate worked when it was server side only

client integration is less successful, for some reason terminate() function is not being called/run