Both new SSViewer() and getViewer() require an $action parameter and I’m not having much luck understanding what that action parameter means. The documentation is a bit sparse on that one.
I hope this post gets an answer for the next person who is interested in this. I don’t actually need to know the answer because I realised I was doing things the hard way. I went back to doing it the simple way.