I’ve not personally built stratum mining software, but I know others have. You might dig through thier code to see if you can get it to work: