使用 websocket 连接 kubernetes 集群实现 terminal 功能时,我们需要对 terminal size 进行调整,来调整每一行的字符数,通过代码研读,我们发现,kubernetes 通过解析 websocket 包中的第一个字符来决定包进入的 channel,如下的内容会进入 channel 4,这个 channel 中接受的数据用来调整 terminal 的大小
4 {"weight": 80, "height": "100"}