How would I resize the stty size of a web terminal with xterm.js?

I’ve created a simple web ssh client with xterm.js, but it doesn’t resize the stty columns and rows.
It does resize the terminal, with the fit addon, but that doesn’t change the stty size.
vim example
The terminal is clearly larger, and clearly has enough space for a bigger vim.
When I execute stty size, this is what I see:
stty size

I’ve tried changing the stty size with the amount of rows and columns on the terminal automatically, but I can’t execute it in the background, as that doesn’t do anything. When I try to execute it in the foreground, it does work, but it shows the command, which I don’t want.

I have tried to find a fix for this, but I can’t.