As part of your current transaction, send a message to (yourself/another endpoint) telling it to e.g. send the mail, or contact the web socket.
The message will only actually be sent if the transaction commits - and then in the handler for that message, you can do the work that should happen after the original transaction committed.